Atom is locking git files


#1

Hello,

I was trying to compress the object database as Git Gui asks me regularly.
It usually works, but this time it seems Atom is locking one of those .pack files, and Git cannot write/delete it.

I’m own Windows, here is a screenshot:

If I close Atom and try again, it succeeds.


#2

What do you mean by “compress the object database”? Do you mean a git gc operation? If so, isn’t the common wisdom that you can just let it happen automatically?


#3

It might be gc, yes. I wasn’t aware of an automatic way. But how can it fix the fact Atom locks the files?
(that gc also takes minutes each time I do it manually, about 10 times a day)


#4

To my understanding, manually running a git gc is very rarely needed because Git does it for you after operations that are likely to create a large number of loose objects, such as merges. See the Git documentation:

http://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery#_git_gc

Atom probably locks those files because it is using them for something, such as providing Git diff information. Since such aggressive cleanup is not necessary, I would just not do it while Atom is running in a repo. (Much like I wouldn’t try running a git gc while doing a big merge or rebase.)