sparse-checkout: write using lockfile
commitfb10ca5b54362e6f860e1e9049e03924fcf5f05b
authorDerrick Stolee <dstolee@microsoft.com>
Thu, 21 Nov 2019 22:04:48 +0000 (21 22:04 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 Nov 2019 07:11:45 +0000 (22 16:11 +0900)
treec5a23ed39b39ab869387abc34e61f52445eeb2d9
parent99dfa6f9702ee81c44ef9382933e4e391ec5d6ee
sparse-checkout: write using lockfile

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.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/sparse-checkout.c
t/t1091-sparse-checkout-builtin.sh