diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-12-18 17:31:57 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-12-21 01:56:20 -0800 |
commit | 0693f9ddad3d9af3d3424087557bbddce480ce3f (patch) | |
tree | bee18d67e504137396ed341f4c847391b0b298fe /t | |
parent | fast-import.c: stricter strtoul check, silence compiler warning (diff) | |
download | tgif-0693f9ddad3d9af3d3424087557bbddce480ce3f.tar.xz |
Make sure lockfiles are unlocked when dying on SIGPIPE
We cleaned up lockfiles upon receiving the usual suspects HUP, TERM, QUIT
but a wicked user could kill us of asphyxiation by piping our output to a
pipe that does not read. Protect ourselves by catching SIGPIPE and clean
up the lockfiles as well in such a case.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t3600-rm.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh index b7d46e50a8..95542e9cfe 100755 --- a/t/t3600-rm.sh +++ b/t/t3600-rm.sh @@ -251,4 +251,21 @@ test_expect_success 'refresh index before checking if it is up-to-date' ' ' +test_expect_success 'choking "git rm" should not let it die with cruft' ' + git reset -q --hard && + H=0000000000000000000000000000000000000000 && + i=0 && + while test $i -lt 12000 + do + echo "100644 $H 0 some-file-$i" + i=$(( $i + 1 )) + done | git update-index --index-info && + git rm -n "some-file-*" | :; + test -f .git/index.lock + status=$? + rm -f .git/index.lock + git reset -q --hard + test "$status" != 0 +' + test_done |