Re: [PATCH] perf: work around the tested repo having an index.lock
- From
Jeff King <peff@peff.net>
- Date
- Jun 2, 2017, 18:45 UTC
- Message-ID
- <20170602184506.x2inwswmcwafyvfy@sigill.intra.peff.net>
- In-Reply-To
- <20170602103330.25663-1-avarab@gmail.com>
On Fri, Jun 02, 2017 at 10:33:30AM +0000, Ævar Arnfjörð Bjarmason wrote:
> When the tested repo has an index.lock file it should be removed. This > file may be present if e.g. git-status previously crashed in that > repo, and it will make a lot of git commands fail. Let's try harder > and remove the lock.
If your git-status is crashing, you probably have bigger problems (and need to clean up the original, too).
But I think a more compelling case is that there may be an ongoing operation in the original repo (e.g., say you are in the middle of writing a commit message) when we do a blind copy of the filesystem contents. You might racily pick up a lockfile.
Should we find and delete all *.lock files in the copied directory? That would get ref locks, etc. Half-formed object files are OK. Technically if you want to get an uncorrupted repository you'd also want to copy refs before objects (in case somebody makes a new object and updates a ref while you're copying).
I don't know how careful it's worth being. I don't really _object_ to this patch exactly, but it does seem like it's picking up one random case (that presumably you hit) and ignoring all of the related cases.
-Peff