I work in a somewhat large and old codebase, where 'git status' takes a significant amount of time (several seconds) to run. I and other have noticed that, when we try to commit something, we often receive this error:
"fatal: Unable to create '/projects/ixengine/.git/index.lock': File exists.
Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
could not detach HEAD"
We're not 100% confident, but local testing seems to indicate that Sublime Text is holding the lock, and that the issue is fixed by adding this to our settings:
I'm curious how sublime calculates the git status; in particular, whether it actually needs to hold a lock on the index. (Assuming that it in fact is holding such a lock- again, I'm not 100% sure.) The git documentation recommends that "Scripts running status in the background should consider using git --no-optional-locks status": https://git-scm.com/docs/git-status#_background_refresh