Add support for config "pull.ff
When the configuration entry 'pull.ff' exists the merge of the pull will use the value as fast forward option. Bug: 474174 Change-Id: Ic8db2f00095ed81528667b064ff523911e6c122e Signed-off-by: Mattias Neuling <neuling@dakosy.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
b4a46b5ed0
commit
0d447b1660
|
@ -48,6 +48,8 @@
|
|||
import java.text.MessageFormat;
|
||||
|
||||
import org.eclipse.jgit.annotations.Nullable;
|
||||
import org.eclipse.jgit.api.MergeCommand.FastForwardMode;
|
||||
import org.eclipse.jgit.api.MergeCommand.FastForwardMode.Merge;
|
||||
import org.eclipse.jgit.api.RebaseCommand.Operation;
|
||||
import org.eclipse.jgit.api.errors.CanceledException;
|
||||
import org.eclipse.jgit.api.errors.DetachedHeadException;
|
||||
|
@ -351,6 +353,7 @@ public PullResult call() throws GitAPIException,
|
|||
merge.include(upstreamName, commitToMerge);
|
||||
merge.setStrategy(strategy);
|
||||
merge.setProgressMonitor(monitor);
|
||||
merge.setFastForward(getFastForwardMode());
|
||||
MergeResult mergeRes = merge.call();
|
||||
monitor.update(1);
|
||||
result = new PullResult(fetchRes, remote, mergeRes);
|
||||
|
@ -472,4 +475,12 @@ public static BranchRebaseMode getRebaseMode(String branchName,
|
|||
}
|
||||
return mode;
|
||||
}
|
||||
|
||||
private FastForwardMode getFastForwardMode() {
|
||||
Config config = repo.getConfig();
|
||||
Merge ffMode = config.getEnum(Merge.values(),
|
||||
ConfigConstants.CONFIG_PULL_SECTION, null,
|
||||
ConfigConstants.CONFIG_KEY_FF, null);
|
||||
return ffMode != null ? FastForwardMode.valueOf(ffMode) : null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,6 +107,12 @@ public class ConfigConstants {
|
|||
*/
|
||||
public static final String CONFIG_PULL_SECTION = "pull";
|
||||
|
||||
/**
|
||||
* The "merge" section
|
||||
* @since 4.9
|
||||
*/
|
||||
public static final String CONFIG_MERGE_SECTION = "merge";
|
||||
|
||||
/**
|
||||
* The "filter" section
|
||||
* @since 4.6
|
||||
|
|
Loading…
Reference in New Issue