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

Bug 350677

Summary: Broken index after rebase error
Product: [Technology] EGit Reporter: Gunnar Wagenknecht <gunnar>
Component: UIAssignee: Jens Baumgart <jens.baumgart>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jens.baumgart
Version: 1.0   
Target Milestone: 1.1-M1   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Gunnar Wagenknecht CLA 2011-06-29 06:23:36 EDT
I was performing a rebase today. The rebase failed because EGit was not able to remove some files it wanted to remove. 

----
org.eclipse.jgit.api.errors.JGitInternalException: Could not delete file T:\myfile.txt
 at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:274)
 at org.eclipse.egit.core.op.PullOperation$1.run(PullOperation.java:82)
 at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
 at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2326)
 at org.eclipse.egit.core.op.PullOperation.execute(PullOperation.java:104)
 at org.eclipse.egit.ui.internal.pull.PullOperationUI.execute(PullOperationUI.java:115)
 at org.eclipse.egit.ui.internal.pull.PullOperationUI$1.run(PullOperationUI.java:90)
 at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.eclipse.jgit.api.errors.JGitInternalException: Could not delete file T:\myfile.txt
 at org.eclipse.jgit.api.RebaseCommand.call(RebaseCommand.java:284)
 at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:265)
 ... 7 more
Caused by: java.io.IOException: Could not delete file T:\myfile.txt
 at org.eclipse.jgit.util.FileUtils.delete(FileUtils.java:134)
 at org.eclipse.jgit.util.FileUtils.delete(FileUtils.java:92)
 at org.eclipse.jgit.dircache.DirCacheCheckout.checkoutEntry(DirCacheCheckout.java:879)
 at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:427)
 at org.eclipse.jgit.api.RebaseCommand.abort(RebaseCommand.java:736)
 at org.eclipse.jgit.api.RebaseCommand.call(RebaseCommand.java:260)
 ... 8 more
----

This is unfortunate. I think that EGit should more graceful here. A dialog could be displayed which asks the user to close the file if it's still opened in an external process.

Anyway, I wanted to resume/abort the rebase but I'm unable to perform any action. I always get "Cannot lock ... index" exception.

----
org.eclipse.jgit.api.errors.JGitInternalException: Cannot lock T:\.git\index
 at org.eclipse.jgit.api.RebaseCommand.call(RebaseCommand.java:204)
 at org.eclipse.egit.core.op.RebaseOperation$1.run(RebaseOperation.java:99)
 at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
 at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2326)
 at org.eclipse.egit.core.op.RebaseOperation.execute(RebaseOperation.java:112)
 at org.eclipse.egit.ui.internal.commands.shared.AbstractRebaseCommandHandler$1.run(AbstractRebaseCommandHandler.java:62)
 at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.io.IOException: Cannot lock T:\.git\index
 at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:188)
 at org.eclipse.jgit.lib.Repository.lockDirCache(Repository.java:886)
 at org.eclipse.jgit.api.RebaseCommand.abort(RebaseCommand.java:732)
 at org.eclipse.jgit.api.RebaseCommand.call(RebaseCommand.java:202)
 ... 6 more
----

 No matter what I do I always get this exception. I also restarted Eclipse several times but it didn't help.
Comment 1 Jens Baumgart CLA 2011-06-29 07:43:11 EDT
To worksround the issue you can delete the lock file (index.lock).
It is contained in the .git directory.
Comment 2 Jens Baumgart CLA 2011-06-29 08:21:29 EDT
Fix proposed: http://egit.eclipse.org/r/3799
Comment 3 Jens Baumgart CLA 2011-07-13 04:33:33 EDT
Fixed with commit eb46d7ffdc6dee1f8570d4be3b6c33cee8fa91c7