diff options
author | Stefan Lay <stefan.lay@sap.com> | 2013-11-21 14:46:12 +0100 |
---|---|---|
committer | Stefan Lay <stefan.lay@sap.com> | 2013-11-21 14:47:24 +0100 |
commit | 4feace2b9ecb90fe591c4317403f6d8e6309287e (patch) | |
tree | 2f992c1be8679fd25aac61972491f4dd08885bd0 | |
parent | 7dce16018e05c0a094b3eb20009e0438764f046e (diff) | |
download | jgit-4feace2b9ecb90fe591c4317403f6d8e6309287e.tar.gz jgit-4feace2b9ecb90fe591c4317403f6d8e6309287e.zip |
Fix parsing Rebase todo lines when commit message is missing
Bug: 422253
Change-Id: I9739b16c91d2df31a481360a712d3479a4eeee2e
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RebaseCommandTest.java | 13 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java | 2 |
2 files changed, 15 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 241d099d19..a3d652b737 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 @@ -1642,6 +1642,19 @@ public class RebaseCommandTest extends RepositoryTestCase { } @Test + public void testRebaseShouldBeAbleToHandleLinesWithoutCommitMessageInRebaseTodoFile() + throws IOException { + String todo = "pick 1111111 \n" + "pick 2222222 Commit 2\n" + + "# Comment line at end\n"; + write(getTodoFile(), todo); + + List<RebaseTodoLine> steps = db.readRebaseTodo(GIT_REBASE_TODO, false); + assertEquals(2, steps.size()); + assertEquals("1111111", steps.get(0).getCommit().name()); + assertEquals("2222222", steps.get(1).getCommit().name()); + } + + @Test public void testRebaseShouldNotFailIfUserAddCommentLinesInPrepareSteps() throws Exception { commitFile(FILE1, FILE1, "master"); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java index cac67e11e9..ef61e22032 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java @@ -197,6 +197,8 @@ public class RebaseTodoFile { } tokenCount++; } + if (tokenCount == 2) + return new RebaseTodoLine(action, commit, ""); //$NON-NLS-1$ return null; } |