diff options
Diffstat (limited to 'org.eclipse.jgit.pgm.test')
-rw-r--r-- | org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java | 5 | ||||
-rw-r--r-- | org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/MergeTest.java | 34 |
2 files changed, 36 insertions, 3 deletions
diff --git a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java index 755174bcbc..a328baec27 100644 --- a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java +++ b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java @@ -49,7 +49,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import org.eclipse.jgit.internal.storage.file.FileRepository; import org.eclipse.jgit.junit.JGitTestUtil; import org.eclipse.jgit.junit.LocalDiskRepositoryTestCase; import org.eclipse.jgit.pgm.CLIGitCommand; @@ -57,7 +56,7 @@ import org.junit.Before; public class CLIRepositoryTestCase extends LocalDiskRepositoryTestCase { /** Test repository, initialized for this test case. */ - protected FileRepository db; + protected Repository db; /** Working directory of {@link #db}. */ protected File trash; @@ -165,7 +164,7 @@ public class CLIRepositoryTestCase extends LocalDiskRepositoryTestCase { assertEquals(toText(expected), toText(actual)); } - private String toText(String[] lines) { + private static String toText(String[] lines) { StringBuilder b = new StringBuilder(); for (String s : lines) { b.append(s); 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 28a107bcb1..d0b363baa9 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 @@ -102,6 +102,40 @@ public class MergeTest extends CLIRepositoryTestCase { } @Test + public void testMergeNoCommit() 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( + "Automatic merge went well; stopped before committing as requested", + execute("git merge --no-commit master")[0]); + } + + @Test + public void testMergeNoCommitSquash() 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(); + + assertArrayEquals( + new String[] { + "Squash commit -- not updating HEAD", + "Automatic merge went well; stopped before committing as requested", + "" }, execute("git merge --no-commit --squash master")); + } + + @Test public void testSquash() throws Exception { git.branchCreate().setName("side").call(); writeTrashFile("file1", "content1"); |