Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 336820

Summary: RebaseCommand abort fails for a non-interactive rebase started from the command line
Product: [Technology] JGit Reporter: Edwin Kempin <edwin.kempin>
Component: JGitAssignee: Project Inbox <jgit.core-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: matthias.sohn, robin, stefan.lay
Version: 2.4   
Target Milestone: 3.0   
Hardware: All   
OS: All   
Whiteboard:

Description Edwin Kempin CLA 2011-02-10 08:58:47 EST
Steps how to reproduce:
1. have two branches with conflicting changes
2. on the command line (e.g. msysgit) rebase one branch onto the other -> this results in a conflict
3. in EGit refresh the Repositories view and see that the repository is in state 'Rebase'
4. try to abort or continue the rebase from EGit and find that the 'Rebase' menu is missing in the context menu of the repository
Comment 1 Robin Stocker CLA 2013-03-09 06:56:48 EST
I assume this is a non-interactive rebase (no -i option on rebase), right?

In that case, I can reproduce this with EGit/JGit master. The menu item is there, but there's an exception because it looks in the wrong folder:

org.eclipse.jgit.api.errors.JGitInternalException: /home/robin/egit/test-workspace/bare/.git/rebase-merge/head-name
	at org.eclipse.jgit.api.RebaseCommand.call(RebaseCommand.java:217)
	at org.eclipse.egit.core.op.RebaseOperation$1.run(RebaseOperation.java:102)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2345)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2327)
	at org.eclipse.egit.core.op.RebaseOperation.execute(RebaseOperation.java:119)
	at org.eclipse.egit.ui.internal.commands.shared.AbstractRebaseCommandHandler$1.run(AbstractRebaseCommandHandler.java:68)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.io.FileNotFoundException: /home/robin/egit/test-workspace/bare/.git/rebase-merge/head-name
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:137)
	at org.eclipse.jgit.util.IO.readFully(IO.java:140)
	at org.eclipse.jgit.util.IO.readFully(IO.java:80)
	at org.eclipse.jgit.api.RebaseCommand.readFile(RebaseCommand.java:873)
	at org.eclipse.jgit.api.RebaseCommand.abort(RebaseCommand.java:843)
	at org.eclipse.jgit.api.RebaseCommand.call(RebaseCommand.java:215)
	... 6 more

It seems C Git creates a ".git/rebase-merge" folder for an interactive rebase, but a ".git/rebase-apply" folder for a non-interactive rebase. In the code which handles --continue and --abort, it checks for both folders.

JGit currently only looks for ".git/rebase-merge".
Comment 2 Robin Stocker CLA 2013-03-09 08:14:12 EST
Support for aborting non-interactive rebase: https://git.eclipse.org/r/11017
Comment 3 Edwin Kempin CLA 2013-03-11 11:11:18 EDT
Yes, this is about a non-interactive rebase.
Comment 4 Matthias Sohn CLA 2013-03-16 18:35:34 EDT
merged as 0e9f1cf57dac274f92a6db38197e14b55b3277af
Comment 5 Matthias Sohn CLA 2013-03-16 18:56:24 EDT
Pushed https://git.eclipse.org/r/#/c/11225/ for review to enable rebase menu in the Repositories View in this situation so that rebase can be aborted/skipped.
Comment 6 Robin Stocker CLA 2013-03-20 19:15:05 EDT
Merged: http://git.eclipse.org/c/egit/egit.git/commit/?id=e7240dac5aa9ff4c3d9088e635ccfb085bb7ab25

I submitted bug 403954 for tracking implementation of "continue" for non-interactive rebase.