|
|
@ -99,6 +99,8 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> { |
|
|
|
|
|
|
|
|
|
|
|
private TagOpt tagOption; |
|
|
|
private TagOpt tagOption; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private FastForwardMode fastForwardMode; |
|
|
|
|
|
|
|
|
|
|
|
private FetchRecurseSubmodulesMode submoduleRecurseMode = null; |
|
|
|
private FetchRecurseSubmodulesMode submoduleRecurseMode = null; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -350,11 +352,9 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> { |
|
|
|
result = new PullResult(fetchRes, remote, rebaseRes); |
|
|
|
result = new PullResult(fetchRes, remote, rebaseRes); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
MergeCommand merge = new MergeCommand(repo); |
|
|
|
MergeCommand merge = new MergeCommand(repo); |
|
|
|
merge.include(upstreamName, commitToMerge); |
|
|
|
MergeResult mergeRes = merge.include(upstreamName, commitToMerge) |
|
|
|
merge.setStrategy(strategy); |
|
|
|
.setStrategy(strategy).setProgressMonitor(monitor) |
|
|
|
merge.setProgressMonitor(monitor); |
|
|
|
.setFastForward(getFastForwardMode()).call(); |
|
|
|
merge.setFastForward(getFastForwardMode()); |
|
|
|
|
|
|
|
MergeResult mergeRes = merge.call(); |
|
|
|
|
|
|
|
monitor.update(1); |
|
|
|
monitor.update(1); |
|
|
|
result = new PullResult(fetchRes, remote, mergeRes); |
|
|
|
result = new PullResult(fetchRes, remote, mergeRes); |
|
|
|
} |
|
|
|
} |
|
|
@ -436,6 +436,27 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> { |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Sets the fast forward mode. It is used if pull is configured to do a |
|
|
|
|
|
|
|
* merge as opposed to rebase. If non-{@code null} takes precedence over the |
|
|
|
|
|
|
|
* fast-forward mode configured in git config. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param fastForwardMode |
|
|
|
|
|
|
|
* corresponds to the --ff/--no-ff/--ff-only options. If |
|
|
|
|
|
|
|
* {@code null} use the value of {@code pull.ff} configured in |
|
|
|
|
|
|
|
* git config. If {@code pull.ff} is not configured fall back to |
|
|
|
|
|
|
|
* the value of {@code merge.ff}. If {@code merge.ff} is not |
|
|
|
|
|
|
|
* configured --ff is the built-in default. |
|
|
|
|
|
|
|
* @return {@code this} |
|
|
|
|
|
|
|
* @since 4.9 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public PullCommand setFastForward( |
|
|
|
|
|
|
|
@Nullable FastForwardMode fastForwardMode) { |
|
|
|
|
|
|
|
checkCallable(); |
|
|
|
|
|
|
|
this.fastForwardMode = fastForwardMode; |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set the mode to be used for recursing into submodules. |
|
|
|
* Set the mode to be used for recursing into submodules. |
|
|
|
* |
|
|
|
* |
|
|
@ -477,6 +498,9 @@ public class PullCommand extends TransportCommand<PullCommand, PullResult> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private FastForwardMode getFastForwardMode() { |
|
|
|
private FastForwardMode getFastForwardMode() { |
|
|
|
|
|
|
|
if (fastForwardMode != null) { |
|
|
|
|
|
|
|
return fastForwardMode; |
|
|
|
|
|
|
|
} |
|
|
|
Config config = repo.getConfig(); |
|
|
|
Config config = repo.getConfig(); |
|
|
|
Merge ffMode = config.getEnum(Merge.values(), |
|
|
|
Merge ffMode = config.getEnum(Merge.values(), |
|
|
|
ConfigConstants.CONFIG_PULL_SECTION, null, |
|
|
|
ConfigConstants.CONFIG_PULL_SECTION, null, |
|
|
|