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

Bug 360141

Summary: "IOException: Cannot lock [..]\.git\index" on hard reset after crash
Product: [Technology] EGit Reporter: Markus Keller <markus.kell.r>
Component: UIAssignee: Matthias Sohn <matthias.sohn>
Status: CLOSED DUPLICATE QA Contact:
Severity: major    
Priority: P3 CC: daniel_megert, matthias.sohn, remy.suen, tomasz.zarna
Version: 1.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Markus Keller CLA 2011-10-06 13:39:00 EDT
Eclipse 3.6.2
J/EGit 1.2.0.201110021920

After killing Eclipse in bug 360133, I cannot use "Team > Reset > Hard" any more, since I always get the error below.

I found bug 350677 comment #1:
> To worksround the issue you can delete the lock file (index.lock).
> It is contained in the .git directory.

This worked, but I shouldn't have to know that as an EGit user.


Error
Thu Oct 06 19:27:32 CEST 2011
mapping tree for commit

java.io.IOException: Cannot lock C:\e\w\R3_6_maintenance_Java7\git\eclipse.jdt.ui\.git\index
at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:193)
at org.eclipse.jgit.dircache.DirCache.lock(DirCache.java:239)
at org.eclipse.jgit.lib.Repository.lockDirCache(Repository.java:896)
at org.eclipse.egit.core.op.ResetOperation.checkoutIndex(ResetOperation.java:246)
at org.eclipse.egit.core.op.ResetOperation.reset(ResetOperation.java:138)
at org.eclipse.egit.core.op.ResetOperation.access$0(ResetOperation.java:115)
at org.eclipse.egit.core.op.ResetOperation$1.run(ResetOperation.java:105)
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.ResetOperation.execute(ResetOperation.java:109)
at org.eclipse.egit.core.internal.job.JobUtil$1.run(JobUtil.java:50)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Matthias Sohn CLA 2011-10-09 19:02:28 EDT
You are right, EGit should be more user friendly here and ask the user if he killed git earlier which may result in such a zombie index.lock file, and if he wants to remove this stale lock file.
Comment 2 Remy Suen CLA 2012-01-27 10:58:19 EST
Just got hit by this also.
Comment 3 Tomasz Zarna CLA 2012-06-18 08:34:04 EDT
Isn't it a dupe of bug 339781?
Comment 4 Markus Keller CLA 2012-06-18 09:32:34 EDT

*** This bug has been marked as a duplicate of bug 339781 ***