{"thread":{"id":"12749","subject":"[PATCH] Test: catch if trash cannot be removed","startedAt":"2008-03-19T04:58:01Z","lastAt":"2008-03-19T04:58:01Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"72373","messageId":"7vd4pr5mzq.fsf@gitster.siamese.dyndns.org","threadId":"12749","inReplyTo":null,"subject":"[PATCH] Test: catch if trash cannot be removed","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-19T04:58:01Z","receivedAt":"2008-03-19T04:58:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"When your test creates an unwritable directory that test framework cannot\nclean out by \"rm -fr trash\", later tests cannot start in a fresh state\nthey expect to.  Detect this and error out early.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/test-lib.sh |    7 ++++++-\n 1 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 268b26c..870b255 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -396,7 +396,12 @@ fi\n \n # Test repository\n test=trash\n-rm -fr \"$test\"\n+rm -fr \"$test\" || {\n+\ttrap - exit\n+\techo >&5 \"FATAL: Cannot prepare test area\"\n+\texit 1\n+}\n+\n test_create_repo $test\n cd \"$test\"\n \n-- \n1.5.5.rc0.122.g8e28f\n"}]}