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 63ef21d8d..eb6c5f0a6 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 @@ -1941,7 +1941,7 @@ public String modifyCommitMessage(String commit) { return ""; // not used } }).call(); - assertEquals(Status.STOPPED, res.getStatus()); + assertEquals(Status.EDIT, res.getStatus()); RevCommit toBeEditted = git.log().call().iterator().next(); assertEquals("updated file1 on master", toBeEditted.getFullMessage()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java index 1feb3f209..ef739bb05 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java @@ -302,7 +302,7 @@ public RebaseResult call() throws GitAPIException, NoHeadException, RevCommit commitToPick = walk .parseCommit(ids.iterator().next()); if (monitor.isCancelled()) - return new RebaseResult(commitToPick); + return new RebaseResult(commitToPick, Status.STOPPED); try { monitor.beginTask(MessageFormat.format( JGitText.get().applyingCommit, @@ -328,9 +328,9 @@ public RebaseResult call() throws GitAPIException, NoHeadException, return abort(new RebaseResult( cherryPickResult.getFailingPaths())); else - return stop(commitToPick); + return stop(commitToPick, Status.STOPPED); case CONFLICTING: - return stop(commitToPick); + return stop(commitToPick, Status.STOPPED); case OK: newHead = cherryPickResult.getNewHead(); } @@ -348,7 +348,7 @@ public RebaseResult call() throws GitAPIException, NoHeadException, continue; case EDIT: rebaseState.createFile(AMEND, commitToPick.name()); - return stop(commitToPick); + return stop(commitToPick, Status.EDIT); case COMMENT: break; case SQUASH: @@ -673,7 +673,8 @@ private PersonIdent parseAuthor() throws IOException { return parseAuthor(raw); } - private RebaseResult stop(RevCommit commitToPick) throws IOException { + private RebaseResult stop(RevCommit commitToPick, RebaseResult.Status status) + throws IOException { PersonIdent author = commitToPick.getAuthorIdent(); String authorScript = toAuthorScript(author); rebaseState.createFile(AUTHOR_SCRIPT, authorScript); @@ -691,7 +692,7 @@ private RebaseResult stop(RevCommit commitToPick) throws IOException { // Remove cherry pick state file created by CherryPickCommand, it's not // needed for rebase repo.writeCherryPickHead(null); - return new RebaseResult(commitToPick); + return new RebaseResult(commitToPick, status); } String toAuthorScript(PersonIdent author) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseResult.java index ff18adce4..6df5ffdd1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseResult.java @@ -84,6 +84,15 @@ public boolean isSuccessful() { return false; } }, + /** + * Stopped for editing in the context of an interactive rebase + */ + EDIT { + @Override + public boolean isSuccessful() { + return false; + } + }, /** * Failed; the original HEAD was restored */ @@ -183,9 +192,10 @@ private RebaseResult(Status status) { * * @param commit * current commit + * @param status */ - RebaseResult(RevCommit commit) { - status = Status.STOPPED; + RebaseResult(RevCommit commit, RebaseResult.Status status) { + this.status = status; currentCommit = commit; }