diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2019-11-21 22:04:48 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-11-22 16:11:45 +0900 |
commit | fb10ca5b54362e6f860e1e9049e03924fcf5f05b (patch) | |
tree | c5a23ed39b39ab869387abc34e61f52445eeb2d9 /t/t1091-sparse-checkout-builtin.sh | |
parent | sparse-checkout: use in-process update for disable subcommand (diff) | |
download | tgif-fb10ca5b54362e6f860e1e9049e03924fcf5f05b.tar.xz |
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>
Diffstat (limited to 't/t1091-sparse-checkout-builtin.sh')
-rwxr-xr-x | t/t1091-sparse-checkout-builtin.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/t/t1091-sparse-checkout-builtin.sh b/t/t1091-sparse-checkout-builtin.sh index b8f18e2a09..f074b7f3be 100755 --- a/t/t1091-sparse-checkout-builtin.sh +++ b/t/t1091-sparse-checkout-builtin.sh @@ -277,4 +277,11 @@ test_expect_success 'revert to old sparse-checkout on empty update' ' ) ' +test_expect_success 'fail when lock is taken' ' + test_when_finished rm -rf repo/.git/info/sparse-checkout.lock && + touch repo/.git/info/sparse-checkout.lock && + test_must_fail git -C repo sparse-checkout set deep 2>err && + test_i18ngrep "File exists" err +' + test_done |