tests: clean after SANITY tests
commit037714252f74ae77e816018e43b2504a1b057246
authorJunio C Hamano <gitster@pobox.com>
Fri, 15 Jun 2018 18:13:39 +0000 (15 11:13 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 15 Jun 2018 18:20:08 +0000 (15 11:20 -0700)
treeb50cad99709711c60d673be889481447226930e3
parentfc54c1af3ec09bab8b8ea09768c2da4069b7f53e
tests: clean after SANITY tests

Some of our tests try to make sure Git behaves sensibly in a
read-only directory, by dropping 'w' permission bit before doing a
test and then restoring it after it is done.  The latter is needed
for the test framework to clean after itself without leaving a
leftover directory that cannot be removed.

Ancient parts of tests however arrange the above with

chmod a-w . &&
... do the test ...
status=$?
chmod 775 .
(exit $status)

which obviously would not work if the test somehow dies before it
has the chance to do "chmod 775".  Rewrite them by following a more
robust pattern recently written tests use, which is

test_when_finished "chmod 775 ." &&
chmod a-w . &&
... do the test ...

Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t0001-init.sh
t/t0070-fundamental.sh
t/t1004-read-tree-m-u-wf.sh
t/t5537-fetch-shallow.sh
t/t7508-status.sh