diff options
author | Stefan Lay <stefan.lay@sap.com> | 2013-11-06 09:43:31 +0100 |
---|---|---|
committer | Stefan Lay <stefan.lay@sap.com> | 2013-11-06 09:43:31 +0100 |
commit | 18069ffe8cbede40cf2524922c262b67656e7021 (patch) | |
tree | b5e046a41ab6b00bf2ac2d764b996cda442dd50e /org.eclipse.jgit.test/tst/org/eclipse | |
parent | 34fbd814d40a18f8be57e3d8a766e854f2fe2d00 (diff) | |
download | jgit-18069ffe8cbede40cf2524922c262b67656e7021.tar.gz jgit-18069ffe8cbede40cf2524922c262b67656e7021.zip |
Rebase interactive should finish if last step is edit
When the last step was an edit step, rebase interactive did not finish
after continuing the rebase. Instead, it returned with the status
FAST_FORWARD.
Change-Id: Ib19857474ac089dfeaae665ad5e95c66c21099b0
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java index eb6c5f0a6b..531e1b0e2c 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java @@ -2294,6 +2294,39 @@ public class RebaseCommandTest extends RepositoryTestCase { }).call(); } + @Test + public void testRebaseEndsIfLastStepIsEdit() throws Exception { + // create file1 on master + writeTrashFile(FILE1, FILE1); + git.add().addFilepattern(FILE1).call(); + git.commit().setMessage("Add file1\nnew line").call(); + assertTrue(new File(db.getWorkTree(), FILE1).exists()); + + // create file2 on master + writeTrashFile("file2", "file2"); + git.add().addFilepattern("file2").call(); + git.commit().setMessage("Add file2\nnew line").call(); + assertTrue(new File(db.getWorkTree(), "file2").exists()); + + git.rebase().setUpstream("HEAD~1") + .runInteractively(new InteractiveHandler() { + + public void prepareSteps(List<RebaseTodoLine> steps) { + steps.get(0).setAction(Action.EDIT); + } + + public String modifyCommitMessage(String commit) { + return commit; + } + }).call(); + git.commit().setAmend(true) + .setMessage("Add file2\nnew line\nanother line").call(); + RebaseResult result = git.rebase().setOperation(Operation.CONTINUE) + .call(); + assertEquals(Status.OK, result.getStatus()); + + } + private File getTodoFile() { File todoFile = new File(db.getDirectory(), GIT_REBASE_TODO); return todoFile; |