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 241d099d1..a3d652b73 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 @@ -1641,6 +1641,19 @@ public class RebaseCommandTest extends RepositoryTestCase { assertEquals("2222222", steps.get(1).getCommit().name()); } + @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 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 { 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 cac67e11e..ef61e2203 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; }