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

Bug 329823

Summary: Attempting commit where one file marked as 'Unmerged' gives NotSupportedException
Product: [Technology] JGit Reporter: James Blackburn <jamesblackburn+eclipse>
Component: JGitAssignee: Project Inbox <jgit.core-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: matthias.sohn
Version: 0.10.0   
Target Milestone: 1.3   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:

Description James Blackburn CLA 2010-11-09 11:13:10 EST
Eclipse EGit (Incubation)	0.10.0.201011021512	org.eclipse.egit.feature.group

On the command line I did:
  git stash ;git checkout <other_branch> ; git stash pop
In Eclipse, I did:
  Right click on Project > Refresh.

File is shown as being in conflict.

I then changed the file to fix the conflict - though didn't add the file with either egit or git to mark it as merged.  I didn't think I would need to do this as egit normally seems to add + commit changes in one operation a la git commit -a.

I right clicked on the project > commit.

The action gave a scary error:

org.eclipse.team.core.TeamException: Committing changes
at org.eclipse.egit.core.op.CommitOperation$1.run(CommitOperation.java:181)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1957)
at org.eclipse.egit.core.op.CommitOperation.execute(CommitOperation.java:192)
at org.eclipse.egit.ui.internal.actions.CommitActionHandler$2.run(CommitActionHandler.java:206)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.eclipse.jgit.errors.NotSupportedException: Cannot work with other stages than zero right now. Won't write corrupt index.
at org.eclipse.jgit.lib.GitIndex.checkWriteOk(GitIndex.java:348)
at org.eclipse.jgit.lib.GitIndex.write(GitIndex.java:268)
at org.eclipse.egit.core.op.CommitOperation.doCommits(CommitOperation.java:295)
at org.eclipse.egit.core.op.CommitOperation.access$8(CommitOperation.java:281)
at org.eclipse.egit.core.op.CommitOperation$1.run(CommitOperation.java:178)
... 5 more

org.eclipse.jgit.errors.NotSupportedException: Cannot work with other stages than zero right now. Won't write corrupt index.
at org.eclipse.jgit.lib.GitIndex.checkWriteOk(GitIndex.java:348)
at org.eclipse.jgit.lib.GitIndex.write(GitIndex.java:268)
at org.eclipse.egit.core.op.CommitOperation.doCommits(CommitOperation.java:295)
at org.eclipse.egit.core.op.CommitOperation.access$8(CommitOperation.java:281)
at org.eclipse.egit.core.op.CommitOperation$1.run(CommitOperation.java:178)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1957)
at org.eclipse.egit.core.op.CommitOperation.execute(CommitOperation.java:192)
at org.eclipse.egit.ui.internal.actions.CommitActionHandler$2.run(CommitActionHandler.java:206)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Matthias Sohn CLA 2012-04-19 03:25:38 EDT
This can't happen anymore as GitIndex was deleted and completely replaced by DirCache which should handle this properly.