Browse Source

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>
stable-4.9
Mattias Neuling 8 years ago committed by Matthias Sohn
parent
commit
0d447b1660
  1. 11
      org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java
  2. 6
      org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java

11
org.eclipse.jgit/src/org/eclipse/jgit/api/PullCommand.java

@ -48,6 +48,8 @@ import java.io.IOException;
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 class PullCommand extends TransportCommand<PullCommand, PullResult> {
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 class PullCommand extends TransportCommand<PullCommand, PullResult> {
}
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;
}
}

6
org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java

@ -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…
Cancel
Save