{"thread":{"id":"35147","subject":"[PATCH] t3600: fix broken \"choking git rm\" test","startedAt":"2013-10-16T00:48:57Z","lastAt":"2013-10-16T00:48:57Z","messageCount":1,"participants":["SZEDER Gábor"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"229052","messageId":"1381884537-16256-1-git-send-email-szeder@ira.uka.de","threadId":"35147","inReplyTo":null,"subject":"[PATCH] t3600: fix broken \"choking git rm\" test","fromName":"SZEDER Gábor","fromEmail":"szeder@ira.uka.de","sentAt":"2013-10-16T00:48:57Z","receivedAt":"2013-10-16T00:48:57Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"The test 'choking \"git rm\" should not let it die with cruft' is\nsupposed to check 'git rm's behavior when interrupted by provoking a\nSIGPIPE while 'git rm' is busily deleting files from a specially\ncrafted index.\n\nThis test is silently broken for the following reasons:\n\n- The test crafts a special index by feeding a large number of index\n  entries with null shas to 'git update-index --index-info'.  It was\n  OK back then when this test was introduced in commit 0693f9ddad\n  (Make sure lockfiles are unlocked when dying on SIGPIPE,\n  2008-12-18), but since commit 4337b5856f (do not write null sha1s to\n  on-disk index, 2012-07-28) null shas are not allowed in the on-disk\n  index causing 'git update-index' to error out.\n\n- The barfing 'git update-index --index-info' should fail the test,\n  but it remains unnoticed because of the severely broken && chain:\n  the test's result depends solely on whether there is a stale lock\n  file left behind, but after 'git update-index' errors out 'git rm'\n  won't be executed at all.\n\nTo fix this test feed only non-null shas to 'git update-index' and\nrestore the && chain (partly by adding a missing && and by using the\ntest_when_finished helper instead of manual cleanup).\n\nSigned-off-by: SZEDER Gábor <szeder@ira.uka.de>\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t3600-rm.sh | 11 ++++-------\n 1 file changed, 4 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t3600-rm.sh b/t/t3600-rm.sh\nindex 824342f413..ad30a61f9e 100755\n--- a/t/t3600-rm.sh\n+++ b/t/t3600-rm.sh\n@@ -230,18 +230,15 @@ test_expect_success 'refresh index before checking if it is up-to-date' '\n \n test_expect_success 'choking \"git rm\" should not let it die with cruft' '\n \tgit reset -q --hard &&\n+\ttest_when_finished \"rm -f .git/index.lock && git reset -q --hard\" &&\n \ti=0 &&\n \twhile test $i -lt 12000\n \tdo\n-\t    echo \"100644 $_z40 0\tsome-file-$i\"\n+\t    echo \"100644 1234567890123456789012345678901234567890 0\tsome-file-$i\"\n \t    i=$(( $i + 1 ))\n \tdone | git update-index --index-info &&\n-\tgit rm -n \"some-file-*\" | :;\n-\ttest -f .git/index.lock\n-\tstatus=$?\n-\trm -f .git/index.lock\n-\tgit reset -q --hard\n-\ttest \"$status\" != 0\n+\tgit rm -n \"some-file-*\" | : &&\n+\ttest_path_is_missing .git/index.lock\n '\n \n test_expect_success 'rm removes subdirectories recursively' '\n-- \n1.8.4.1.495.gd8d272e\n"}]}