aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorStefan Lay <stefan.lay@sap.com>2013-11-21 14:00:30 +0100
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2013-11-22 16:50:44 -0500
commit8339a07e8314d6a40e15252bcc736a46c0aca0ea (patch)
tree25010ddb4045ef4a1810953d9751fbe92d7bf55b /org.eclipse.jgit.test/tst
parent4feace2b9ecb90fe591c4317403f6d8e6309287e (diff)
downloadjgit-8339a07e8314d6a40e15252bcc736a46c0aca0ea.tar.gz
jgit-8339a07e8314d6a40e15252bcc736a46c0aca0ea.zip
Fix FIXUP error for blank lines in interactive rebase
Empty lines of discarded commit messages were added to the commit message because they were not commented out properly. Bug: 422246 Change-Id: I263e8a6b30a3392d8b4f09c0695505068a0a485d Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java38
1 files changed, 38 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 a3d652b737..2c9fce8186 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
@@ -2250,6 +2250,44 @@ public class RebaseCommandTest extends RepositoryTestCase {
head1Commit.getFullMessage());
}
+ @Test
+ public void testRebaseInteractiveFixupWithBlankLines() 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").call();
+ assertTrue(new File(db.getWorkTree(), "file2").exists());
+
+ // update FILE1 on master
+ writeTrashFile(FILE1, "blah");
+ git.add().addFilepattern(FILE1).call();
+ git.commit().setMessage("updated file1 on master\n\nsome text").call();
+
+ git.rebase().setUpstream("HEAD~2")
+ .runInteractively(new InteractiveHandler() {
+
+ public void prepareSteps(List<RebaseTodoLine> steps) {
+ steps.get(1).setAction(Action.FIXUP);
+ }
+
+ public String modifyCommitMessage(String commit) {
+ fail("No callback to modify commit message expected for single fixup");
+ return commit;
+ }
+ }).call();
+
+ RevWalk walk = new RevWalk(db);
+ ObjectId headId = db.resolve(Constants.HEAD);
+ RevCommit headCommit = walk.parseCommit(headId);
+ assertEquals("Add file2",
+ headCommit.getFullMessage());
+ }
@Test(expected = InvalidRebaseStepException.class)
public void testRebaseInteractiveFixupFirstCommitShouldFail()