Re: [PATCH v3 16/17] sparse-checkout: write using lockfile
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Oct 14, 2019, 20:41 UTC
- Message-ID
- <0c8bcf25-3c32-8151-fa89-84170cb1aff4@gmail.com>
- In-Reply-To
- <CABPp-BGCNpZWoWk4coNEpA0zS2g0HXi5Kzb+QVusyLRt0fy=zw@mail.gmail.com>
On 10/12/2019 6:59 PM, Elijah Newren wrote:
Show 17 quoted lines
> On Mon, Oct 7, 2019 at 1:08 PM Derrick Stolee via GitGitGadget > <gitgitgadget@gmail.com> wrote: >> >> From: Derrick Stolee <dstolee@microsoft.com> >> >> If two 'git sparse-checkout set' subcommands are launched at the >> same time, the behavior can be unexpected as they compete to write >> the sparse-checkout file and update the working directory. >> >> Take a lockfile around the writes to the sparse-checkout file. In >> addition, acquire this lock around the working directory update >> to avoid two commands updating the working directory in different >> ways. > > Wow, there's something I never would have thought to check. Did you > have folks run into this, or is this just some defensive programming? > Either way, I'm impressed.
This is defensive programming thanks to Kevin Willford's careful review [1].
-Stolee
[1] https://github.com/microsoft/git/pull/204#discussion_r330252848