summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorRobin Stocker <robin@nibor.org>2011-04-06 22:55:10 +0200
committerRobin Stocker <robin@nibor.org>2011-04-06 22:57:49 +0200
commit5dbef3fa51053b37f68b44ed390cab6dc8336dcc (patch)
tree3c45c0394a561fc091c1ad0c2239f10ef9d8b1e0 /org.eclipse.jgit.test
parent3151657404859454bdf60345c09b536d1269c0c8 (diff)
downloadjgit-5dbef3fa51053b37f68b44ed390cab6dc8336dcc.tar.gz
jgit-5dbef3fa51053b37f68b44ed390cab6dc8336dcc.zip
Add "Conflicts" section to merge message on conflict
The same as with cherry-pick, the commit message of a merge should include a "Conflicts" section when the merge resulted in conflicts. Change-Id: I6261dc898262322924af5ca1bef841a654b0df55 Signed-off-by: Robin Stocker <robin@nibor.org>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java
index 94f0906a30..d5c00257bb 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java
@@ -54,6 +54,7 @@ import java.util.Iterator;
import org.eclipse.jgit.api.MergeResult.MergeStatus;
import org.eclipse.jgit.api.errors.InvalidMergeHeadsException;
import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.RepositoryState;
import org.eclipse.jgit.lib.RepositoryTestCase;
import org.eclipse.jgit.merge.MergeStrategy;
@@ -205,6 +206,37 @@ public class MergeCommandTest extends RepositoryTestCase {
}
@Test
+ public void testMergeMessage() throws Exception {
+ Git git = new Git(db);
+
+ writeTrashFile("a", "1\na\n3\n");
+ git.add().addFilepattern("a").call();
+ RevCommit initialCommit = git.commit().setMessage("initial").call();
+
+ createBranch(initialCommit, "refs/heads/side");
+ checkoutBranch("refs/heads/side");
+
+ writeTrashFile("a", "1\na(side)\n3\n");
+ git.add().addFilepattern("a").call();
+ git.commit().setMessage("side").call();
+
+ checkoutBranch("refs/heads/master");
+
+ writeTrashFile("a", "1\na(main)\n3\n");
+ git.add().addFilepattern("a").call();
+ git.commit().setMessage("main").call();
+
+ Ref sideBranch = db.getRef("side");
+
+ git.merge().include(sideBranch)
+ .setStrategy(MergeStrategy.RESOLVE).call();
+
+ assertEquals("Merge branch 'side'\n\nConflicts:\n\ta\n",
+ db.readMergeCommitMsg());
+
+ }
+
+ @Test
public void testMergeNonVersionedPaths() throws Exception {
Git git = new Git(db);