summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm.test
diff options
context:
space:
mode:
authorAxel Richard <axel.richard@obeo.fr>2014-08-29 14:37:09 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2014-08-30 01:17:24 +0200
commit46f3007b52a5d12c5a973957128ac38680b20ab8 (patch)
treec51edac33977b1885f310945a6bba8e8220abdea /org.eclipse.jgit.pgm.test
parent7b7d033ee1fdd8e81ae2ad7dc9e1ae12cbd9ddfa (diff)
downloadjgit-46f3007b52a5d12c5a973957128ac38680b20ab8.tar.gz
jgit-46f3007b52a5d12c5a973957128ac38680b20ab8.zip
Handle -m option for Merge command
Set the commit message to be used for the merge commit (in case one is created) Bug: 442886 Change-Id: Ie5ecc13822faa366f00b3daa07f74c8441cae195 Signed-off-by: Axel Richard <axel.richard@obeo.fr> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm.test')
-rw-r--r--org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeTest.java25
1 files changed, 24 insertions, 1 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 8c5066af5f..975e8c4f76 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
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012, IBM Corporation and others.
+ * Copyright (C) 2012, 2014 IBM Corporation and others.
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
@@ -45,9 +45,12 @@ package org.eclipse.jgit.pgm;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
+import java.util.Iterator;
+
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.CLIRepositoryTestCase;
import org.eclipse.jgit.merge.MergeStrategy;
+import org.eclipse.jgit.revwalk.RevCommit;
import org.junit.Before;
import org.junit.Test;
@@ -209,4 +212,24 @@ public class MergeTest extends CLIRepositoryTestCase {
assertEquals("fatal: Not possible to fast-forward, aborting.",
execute("git merge master --ff-only")[0]);
}
+
+ @Test
+ public void testMergeWithUserMessage() throws Exception {
+ git.branchCreate().setName("side").call();
+ writeTrashFile("master", "content");
+ git.add().addFilepattern("master").call();
+ git.commit().setMessage("master commit").call();
+ git.checkout().setName("side").call();
+ writeTrashFile("side", "content");
+ git.add().addFilepattern("side").call();
+ git.commit().setMessage("side commit").call();
+
+ assertEquals("Merge made by the '" + MergeStrategy.RECURSIVE.getName()
+ + "' strategy.",
+ execute("git merge master -m \"user message\"")[0]);
+
+ Iterator<RevCommit> it = git.log().call().iterator();
+ RevCommit newHead = it.next();
+ assertEquals("user message", newHead.getFullMessage());
+ }
}