Re: [PATCH 17/23] get_packed_ref_cache(): assume "packed-refs" won't change while locked
- From
Stefan Beller <sbeller@google.com>
- Date
- May 17, 2017, 17:57 UTC
- Message-ID
- <CAGZ79kb65sv8g6XUQMcGTkZ0ubpY2LYpj7g2wv15knXuv7oKhw@mail.gmail.com>
- In-Reply-To
- <eedc8f85c8237515bc66584649b1e3f3d547049c.1495014840.git.mhagger@alum.mit.edu>
On Wed, May 17, 2017 at 5:05 AM, Michael Haggerty <mhagger@alum.mit.edu> wrote:
> If we've got the "packed-refs" file locked, then it can't change; > there's no need to keep calling `stat_validity_check()` on it.
This change will work in a world where all Git implementations obey a lock. If there is at least one implementation that doesn't care about the existence of lock files we may introduce a race here.
I am not sure if it is worth to be extra careful in the common case though. But I could imagine some people using a git repo on an NFS concurrently with different implementations and one of them is an old / careless lock-ignoring implementation.
My opinion is not strong enough that I'd veto such a patch just food for thought.
Thanks, Stefan