diff options
author | Robin Stocker <robin@nibor.org> | 2013-07-02 07:12:32 -0400 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org <gerrit@eclipse.org> | 2013-07-02 07:12:32 -0400 |
commit | 21b3a16ab7692230ca7e435f99f0623e21aa353c (patch) | |
tree | 61101b770dc798bf04bd53636f011aa5a440b568 /org.eclipse.jgit.test | |
parent | 6cc532a43cf28403cb623d3df8600a2542a40a43 (diff) | |
parent | 6845bb5b3e46785f940d1830e08645711ffc1273 (diff) | |
download | jgit-21b3a16ab7692230ca7e435f99f0623e21aa353c.tar.gz jgit-21b3a16ab7692230ca7e435f99f0623e21aa353c.zip |
Merge "Update HEAD in cherry-picking several commits"
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java index f66661a52f..2668c116a0 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java @@ -111,6 +111,42 @@ public class CherryPickCommandTest extends RepositoryTestCase { assertFalse(history.hasNext()); } + @Test + public void testSequentialCherryPick() throws IOException, JGitInternalException, + GitAPIException { + Git git = new Git(db); + + writeTrashFile("a", "first line\nsec. line\nthird line\n"); + git.add().addFilepattern("a").call(); + RevCommit firstCommit = git.commit().setMessage("create a").call(); + + writeTrashFile("a", "first line\nsec. line\nthird line\nfourth line\n"); + git.add().addFilepattern("a").call(); + RevCommit enlargingA = git.commit().setMessage("enlarged a").call(); + + writeTrashFile("a", + "first line\nsecond line\nthird line\nfourth line\n"); + git.add().addFilepattern("a").call(); + RevCommit fixingA = git.commit().setMessage("fixed a").call(); + + git.branchCreate().setName("side").setStartPoint(firstCommit).call(); + checkoutBranch("refs/heads/side"); + + writeTrashFile("b", "nothing to do with a"); + git.add().addFilepattern("b").call(); + git.commit().setMessage("create b").call(); + + CherryPickResult result = git.cherryPick().include(enlargingA).include(fixingA).call(); + assertEquals(CherryPickResult.CherryPickStatus.OK, result.getStatus()); + + Iterator<RevCommit> history = git.log().call().iterator(); + assertEquals("fixed a", history.next().getFullMessage()); + assertEquals("enlarged a", history.next().getFullMessage()); + assertEquals("create b", history.next().getFullMessage()); + assertEquals("create a", history.next().getFullMessage()); + assertFalse(history.hasNext()); + } + @Test public void testCherryPickDirtyIndex() throws Exception { Git git = new Git(db); |