summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2013-03-25 03:39:58 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2013-04-15 21:46:12 +0200
commitaa7be667bcca4bdb28b2485e28a05da54c431df7 (patch)
tree225b7caa073e96f1c5ef3ed83a65eaec6dcaa66a
parenteaa52b12f542e1d52c277989533a3c1bea3cc02e (diff)
downloadjgit-aa7be667bcca4bdb28b2485e28a05da54c431df7.tar.gz
jgit-aa7be667bcca4bdb28b2485e28a05da54c431df7.zip
Make recursive merge strategy the default merge strategy
Use recursive merge as the default strategy since it can successfully merge more cases than the resolve strategy can. This is also the default in native Git. Change-Id: I38fd522edb2791f15d83e99038185edb09fed8e1 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeTest.java2
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java4
6 files changed, 10 insertions, 9 deletions
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeTest.java
index d0b363baa9..8c5066af5f 100644
--- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeTest.java
+++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeTest.java
@@ -97,7 +97,7 @@ public class MergeTest extends CLIRepositoryTestCase {
git.add().addFilepattern("side").call();
git.commit().setMessage("side commit").call();
- assertEquals("Merge made by the '" + MergeStrategy.RESOLVE.getName()
+ assertEquals("Merge made by the '" + MergeStrategy.RECURSIVE.getName()
+ "' strategy.", execute("git merge master")[0]);
}
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java
index 0a149016e6..24794e75f2 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Merge.java
@@ -75,7 +75,7 @@ class Merge extends TextBuiltin {
@Option(name = "--no-commit", usage = "usage_noCommit")
private boolean noCommit = false;
- private MergeStrategy mergeStrategy = MergeStrategy.RESOLVE;
+ private MergeStrategy mergeStrategy = MergeStrategy.RECURSIVE;
@Argument(required = true)
private String ref;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
index dca7197d18..d5d9559296 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
@@ -150,7 +150,7 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> {
String cherryPickName = srcCommit.getId().abbreviate(7).name()
+ " " + srcCommit.getShortMessage(); //$NON-NLS-1$
- ResolveMerger merger = (ResolveMerger) MergeStrategy.RESOLVE
+ ResolveMerger merger = (ResolveMerger) MergeStrategy.RECURSIVE
.newMerger(repo);
merger.setWorkingTreeIterator(new FileTreeIterator(repo));
merger.setBase(srcParent.getTree());
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
index 8f6e9cbb5d..509203e528 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
@@ -95,7 +95,7 @@ import org.eclipse.jgit.util.StringUtils;
*/
public class MergeCommand extends GitCommand<MergeResult> {
- private MergeStrategy mergeStrategy = MergeStrategy.RESOLVE;
+ private MergeStrategy mergeStrategy = MergeStrategy.RECURSIVE;
private List<Ref> commits = new LinkedList<Ref>();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
index be8f66de37..c3922099d0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
@@ -160,7 +160,7 @@ public class RevertCommand extends GitCommand<RevCommit> {
String revertName = srcCommit.getId().abbreviate(7).name()
+ " " + srcCommit.getShortMessage(); //$NON-NLS-1$
- ResolveMerger merger = (ResolveMerger) MergeStrategy.RESOLVE
+ ResolveMerger merger = (ResolveMerger) MergeStrategy.RECURSIVE
.newMerger(repo);
merger.setWorkingTreeIterator(new FileTreeIterator(repo));
merger.setBase(srcCommit.getTree());
@@ -194,14 +194,15 @@ public class RevertCommand extends GitCommand<RevCommit> {
merger.getBaseCommit(0, 1),
new ObjectId[] { headCommit.getId(),
srcParent.getId() },
- MergeStatus.FAILED, MergeStrategy.RESOLVE,
+ MergeStatus.FAILED, MergeStrategy.RECURSIVE,
merger.getMergeResults(), failingPaths, null);
else
failingResult = new MergeResult(null,
merger.getBaseCommit(0, 1),
new ObjectId[] { headCommit.getId(),
srcParent.getId() },
- MergeStatus.CONFLICTING, MergeStrategy.RESOLVE,
+ MergeStatus.CONFLICTING,
+ MergeStrategy.RECURSIVE,
merger.getMergeResults(), failingPaths, null);
if (!merger.failed() && !unmergedPaths.isEmpty()) {
String message = new MergeMessageFormatter()
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
index f515609085..b1fde1dc4c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
@@ -168,7 +168,7 @@ public class StashApplyCommand extends GitCommand<ObjectId> {
.getParent(1));
ObjectId stashHeadCommit = stashCommit.getParent(0);
- ResolveMerger merger = (ResolveMerger) MergeStrategy.RESOLVE
+ ResolveMerger merger = (ResolveMerger) MergeStrategy.RECURSIVE
.newMerger(repo);
merger.setCommitNames(new String[] { "stashed HEAD", "HEAD",
"stash" });
@@ -181,7 +181,7 @@ public class StashApplyCommand extends GitCommand<ObjectId> {
dco.setFailOnConflict(true);
dco.checkout(); // Ignoring failed deletes....
if (applyIndex) {
- ResolveMerger ixMerger = (ResolveMerger) MergeStrategy.RESOLVE
+ ResolveMerger ixMerger = (ResolveMerger) MergeStrategy.RECURSIVE
.newMerger(repo, true);
ixMerger.setCommitNames(new String[] { "stashed HEAD",
"HEAD", "stashed index" });