diff options
author | Tomasz Zarna <tomasz.zarna@tasktop.com> | 2012-10-29 16:21:59 +0100 |
---|---|---|
committer | Tomasz Zarna <tomasz.zarna@tasktop.com> | 2012-11-16 11:04:13 +0100 |
commit | 318f3d464307e3efd8342852310c17e71a7282fe (patch) | |
tree | bcd251a7110555cd46c5ab18e5e673f52c214cd2 /org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm | |
parent | cb0f0ad4cfe2733ff09c2ce4d3b72265ccfee281 (diff) | |
download | jgit-318f3d464307e3efd8342852310c17e71a7282fe.tar.gz jgit-318f3d464307e3efd8342852310c17e71a7282fe.zip |
Add support for --no-ff while merging
Bug: 394432
Change-Id: I373128c0ba949f9b24248874f77f3d68b50ccfd1
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
Diffstat (limited to 'org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm')
-rw-r--r-- | org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeTest.java | 59 |
1 files changed, 57 insertions, 2 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 87a2c85533..28a107bcb1 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 @@ -42,8 +42,8 @@ */ package org.eclipse.jgit.pgm; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.lib.CLIRepositoryTestCase; @@ -82,7 +82,8 @@ public class MergeTest extends CLIRepositoryTestCase { git.commit().setMessage("commit").call(); git.checkout().setName("side").call(); - assertEquals("Fast-forward", execute("git merge master")[0]); + assertArrayEquals(new String[] { "Updating 6fd41be..26a81a1", + "Fast-forward", "" }, execute("git merge master")); } @Test @@ -120,4 +121,58 @@ public class MergeTest extends CLIRepositoryTestCase { "" }, execute("git merge master --squash")); } + + @Test + public void testNoFastForward() throws Exception { + git.branchCreate().setName("side").call(); + writeTrashFile("file", "master"); + git.add().addFilepattern("file").call(); + git.commit().setMessage("commit").call(); + git.checkout().setName("side").call(); + + assertEquals("Merge made by the 'recursive' strategy.", + execute("git merge master --no-ff")[0]); + assertArrayEquals(new String[] { + "commit 6db23724012376e8407fc24b5da4277a9601be81", // + "Author: GIT_COMMITTER_NAME <GIT_COMMITTER_EMAIL>", // + "Date: Sat Aug 15 20:12:58 2009 -0330", // + "", // + " Merge branch 'master' into side", // + "", // + "commit 6fd41be26b7ee41584dd997f665deb92b6c4c004", // + "Author: GIT_COMMITTER_NAME <GIT_COMMITTER_EMAIL>", // + "Date: Sat Aug 15 20:12:58 2009 -0330", // + "", // + " initial commit", // + "", // + "commit 26a81a1c6a105551ba703a8b6afc23994cacbae1", // + "Author: GIT_COMMITTER_NAME <GIT_COMMITTER_EMAIL>", // + "Date: Sat Aug 15 20:12:58 2009 -0330", // + "", // + " commit", // + "", // + "" + }, execute("git log")); + } + + @Test + public void testNoFastForwardAndSquash() throws Exception { + assertEquals("fatal: You cannot combine --squash with --no-ff.", + execute("git merge master --no-ff --squash")[0]); + } + + @Test + public void testFastForwardOnly() throws Exception { + git.branchCreate().setName("side").call(); + writeTrashFile("file", "master"); + git.add().addFilepattern("file").call(); + git.commit().setMessage("commit#1").call(); + git.checkout().setName("side").call(); + writeTrashFile("file", "side"); + git.add().addFilepattern("file").call(); + git.commit().setMessage("commit#2").call(); + + assertEquals("fatal: Not possible to fast-forward, aborting.", + execute("git merge master --ff-only")[0]); + } } |