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

Bug 332643

Summary: Stuck in Rebase interactive state
Product: [Technology] EGit Reporter: Andrew Gvozdev <angvoz.dev>
Component: CoreAssignee: Mathias Kinzler <mathias.kinzler>
Status: RESOLVED WORKSFORME QA Contact:
Severity: major    
Priority: P3 CC: caniszczyk, christian.halstrick, mathias.kinzler, matthias.sohn, remy.suen, stefan.lay
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
screenshot none

Description Andrew Gvozdev CLA 2010-12-15 10:09:43 EST
I was trying to rebase in egit but something went fishy and I decided to abandon the rebase. Now I got stuck and cannot return to normal. In Project Explorer (or Git Repositories perspective) I see [branch|Rebase interactive branch] next to my project. I tried a few things like checking out a different branch, same branch, hard reset to current commit etc. but that did not make a difference. When I try git status in command line there is just regular "nothing to commit" message and nothing about being in the middle of rebase.

Is there some workaround to restore? This would be time consuming to me to restore my configuration from scratch. My repository is big and I did jump through hoops to make egit work for me. I'd rather don't do it every time where there is a problem with rebase.

I am using the most recent egit from nightly updates site.
Comment 1 Matthias Sohn CLA 2010-12-15 10:36:54 EST
Did you try Rebase > Abort from the Repositories View as described here
http://wiki.eclipse.org/EGit/User_Guide#Aborting_Rebase ?
Comment 2 Andrew Gvozdev CLA 2010-12-15 11:32:59 EST
(In reply to comment #1)
> Did you try Rebase > Abort from the Repositories View as described here
> http://wiki.eclipse.org/EGit/User_Guide#Aborting_Rebase ?
Good point, thanks. Perhaps this option should be available in branch context menu where rebase starts? That would let us users to keep ignoring documentation. But seriously, checking out a different branch, reset etc. should abort it automatically or with a warning message.
Comment 3 Andrew Gvozdev CLA 2011-01-22 15:16:00 EST
Created attachment 187365 [details]
screenshot

OK, another attempt. I am stuck in there again. I had to do a complex rebase (because of rebuilding CDT git mirror, see bug 332365). I elected command line git to do that. After many tries and errors including merges, rebases, applying patches, resolving conflicts, backing up etc. I managed to do just what I wanted, i.e. placed my branch on the new tree preserving history and merging points. However, after all was done and I opened egit I was surprised by egit stuck in Rebase interactive state. This time there is no Abort option in the Repositories view. "git status" from command line reports "nothing to commit (working directory clean)". I may have opened egit in the middle of my efforts to check on the history, but I was careful not to do any repository changing operations from egit and to close it before I did such from command line git.

  Eclipse EGit (Incubation)	0.11.0.201101211042	org.eclipse.egit.feature.group
  Eclipse JGit (Incubation)	0.11.0.201101211040	org.eclipse.jgit.feature.group
Comment 4 Andrew Gvozdev CLA 2011-01-22 22:44:14 EST
Looks like this problem happens after "git rebase --abort" from command line. I am using cygwin git version 1.7.2.3.
Comment 5 Andrew Gvozdev CLA 2011-01-22 22:50:47 EST
Alright, another rebase from command line gave the wanted hint:
> It seems that I cannot create a rebase-apply directory, and
> I wonder if you are in the middle of patch application or another
> rebase.  If that is not the case, please
>         rm -fr /cygdrive/c/Andre/eclipse-CDT-HEAD/workspace-github/git-repositories/sd80/.git/rebase-apply
> and run me again.  I am stopping in case you still have something
> valuable there.
Comment 6 Mathias Kinzler CLA 2011-01-24 11:57:37 EST
Are you sure EGit shows a "Rebase interactive" state and not a "Rebase" state?

Background: there are in fact two "rebase" flavors in the command line, the "normal" and the "interactive" one. The first one always creates a "rebase-apply" folder, while the "interactive" mode always creates a "rebase-merge" folder under your .git folder.
EGit's rebase is implemented as "interactive" (even if it does not [yet] bring a dialog like rebase --i as the command line does), so it would create a "rebase-merge" folder.
The error message from your command line would indicate that you have at one point started a "normal" rebase (using the command line) and never quite completed it (using git rebase --continue until completed) or aborted it (using git rebase --abort), which is why the rebase-apply folder is still there...

Now, since EGit can only work with the "interactive" version of rebase, it does show the Repository state as "Rebase" (not as "Rebase interactive", though), but does not offer to abort here. One could arguably want to have a "Rebase->Abort" action in Egit for this case, but I wonder if this would be more confusing than helpful (as we couldn't offer the corresponding "Rebase->Continue" action).

Anyway, if the command line says that it is still in REBASE state, you must complete or abort the rebase using git rebase --continue or git rebase --abort. Once completed, EGit should revert to the "Normal" state.
If the command line does not detect the Repository as being in "Rebase" state, then I'm lost. In this case, could you please attach the output from issuing "git reflog" in your command line?
Comment 7 Andrew Gvozdev CLA 2011-01-24 12:20:26 EST
(In reply to comment #6)
> Are you sure EGit shows a "Rebase interactive" state and not a "Rebase" state?
That's why I attached the screenshot for the experts to see.

I restate that I started a rebase and completed it with "git rebase --abort" (from command line obviously). "git reflog" does not show anything suspicious to me:
$ git reflog
6a0ec00 HEAD@{0}: checkout: moving from sd80 to sd80-new
c783ef6 HEAD@{1}: commit (amend):Merge branch 'origin' into sd80
797c797 HEAD@{2}: checkout: moving from sd80-new to sd80
6a0ec00 HEAD@{3}: checkout: moving from sd80 to sd80-new
797c797 HEAD@{4}: merge origin: Merge made by recursive.
6a0ec00 HEAD@{5}: rebase: updating HEAD
81119c5 HEAD@{6}: checkout: moving from sd80 to 81119c569d00737ff5dc40087efc0f2c631017b3^0
6a0ec00 HEAD@{7}: merge sd80-new: Fast-forward

However I got rebase-apply folder:
$ find . -name rebase-apply
./.git/rebase-apply

$ git status
# On branch sd80-new
nothing to commit (working directory clean)

I guess it makes cygwin git bug?
Comment 8 Mathias Kinzler CLA 2011-01-25 03:07:24 EST
I should have looked at the screenshot first, sorry for that.

In any case, could you indicate the sequence of git commands that resulted in this situation?
Comment 9 Andrew Gvozdev CLA 2011-01-27 16:44:12 EST
(In reply to comment #8)
> I should have looked at the screenshot first, sorry for that.
> In any case, could you indicate the sequence of git commands that resulted in
> this situation?
1. Some messy git operations in command line, see comment 3.
2. "git status" and I was pretty sure everything was OK.
3. "git rebase origin". No commits done.
4. "git rebase --abort". After that I got leftovers in ./.git/rebase-apply, see comment 7.
5. Opened egit, see screenshot comment 3. "Rebase/Apply mailbox" state. I have no "mailbox" branch but thinking about it I may have tried "git apply" somewhere long time ago on step 1.
6. New "git rebase origin" suggested to remove ./.git/rebase-apply

I got into that again on the same cloned repository (pretty messy one) and second in the row "git rebase --abort" fixed that. I tried to reproduce on a new simple repository and could not.
Comment 10 Stefan Lay CLA 2011-06-28 07:18:47 EDT
Issue is not reproducable.
Comment 11 Remy Suen CLA 2011-08-27 07:27:20 EDT
Also see bug 336812.