summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorStefan Lay <stefan.lay@sap.com>2013-11-06 09:43:31 +0100
committerStefan Lay <stefan.lay@sap.com>2013-11-06 09:43:31 +0100
commit18069ffe8cbede40cf2524922c262b67656e7021 (patch)
treeb5e046a41ab6b00bf2ac2d764b996cda442dd50e /org.eclipse.jgit
parent34fbd814d40a18f8be57e3d8a766e854f2fe2d00 (diff)
downloadjgit-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')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java23
1 files changed, 14 insertions, 9 deletions
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 ef739bb050..ea48688ff9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
@@ -284,6 +284,9 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
List<RebaseTodoLine> steps = repo.readRebaseTodo(
rebaseState.getPath(GIT_REBASE_TODO), false);
+ if (steps.size() == 0) {
+ return finishRebase(walk.parseCommit(repo.resolve(Constants.HEAD)), false);
+ }
if (isInteractive()) {
interactiveHandler.prepareSteps(steps);
repo.writeRebaseTodoFile(rebaseState.getPath(GIT_REBASE_TODO),
@@ -370,15 +373,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
monitor.endTask();
}
}
- if (newHead != null) {
- String headName = rebaseState.readFile(HEAD_NAME);
- updateHead(headName, newHead, upstreamCommit);
- FileUtils.delete(rebaseState.getDir(), FileUtils.RECURSIVE);
- if (lastStepWasForward)
- return RebaseResult.FAST_FORWARD_RESULT;
- return RebaseResult.OK_RESULT;
- }
- return RebaseResult.FAST_FORWARD_RESULT;
+ return finishRebase(newHead, lastStepWasForward);
} catch (CheckoutConflictException cce) {
return new RebaseResult(cce.getConflictingPaths());
} catch (IOException ioe) {
@@ -386,6 +381,16 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
}
}
+ private RebaseResult finishRebase(RevCommit newHead,
+ boolean lastStepWasForward) throws IOException {
+ String headName = rebaseState.readFile(HEAD_NAME);
+ updateHead(headName, newHead, upstreamCommit);
+ FileUtils.delete(rebaseState.getDir(), FileUtils.RECURSIVE);
+ if (lastStepWasForward || newHead == null)
+ return RebaseResult.FAST_FORWARD_RESULT;
+ return RebaseResult.OK_RESULT;
+ }
+
private void checkSteps(List<RebaseTodoLine> steps)
throws InvalidRebaseStepException, IOException {
if (steps.isEmpty())