]> granicus.if.org Git - git/commit
sparse-checkout: write using lockfile
authorDerrick Stolee <dstolee@microsoft.com>
Mon, 21 Oct 2019 13:56:25 +0000 (13:56 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 Oct 2019 03:42:21 +0000 (12:42 +0900)
commita879c5bfb5738d7f8468af1f9b02f12e6bb73c38
treee893659c387fe04849c5bc3742952a7c710ad50d
parentefd9c53b6d4a79029f5fb67be36c6a7930eaed8e
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