summaryrefslogtreecommitdiff
path: root/t/t1004-read-tree-m-u-wf.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-06-15 18:13:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-06-15 18:20:08 (GMT)
commit037714252f74ae77e816018e43b2504a1b057246 (patch)
treeb50cad99709711c60d673be889481447226930e3 /t/t1004-read-tree-m-u-wf.sh
parentfc54c1af3ec09bab8b8ea09768c2da4069b7f53e (diff)
downloadgit-037714252f74ae77e816018e43b2504a1b057246.zip
git-037714252f74ae77e816018e43b2504a1b057246.tar.gz
git-037714252f74ae77e816018e43b2504a1b057246.tar.bz2
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>
Diffstat (limited to 't/t1004-read-tree-m-u-wf.sh')
-rwxr-xr-xt/t1004-read-tree-m-u-wf.sh6
1 files changed, 2 insertions, 4 deletions
diff --git a/t/t1004-read-tree-m-u-wf.sh b/t/t1004-read-tree-m-u-wf.sh
index c7ce5d8..826cd32 100755
--- a/t/t1004-read-tree-m-u-wf.sh
+++ b/t/t1004-read-tree-m-u-wf.sh
@@ -179,6 +179,8 @@ test_expect_success 'funny symlink in work tree' '
test_expect_success SANITY 'funny symlink in work tree, un-unlink-able' '
+ test_when_finished "chmod u+w a 2>/dev/null; rm -fr a b" &&
+
rm -fr a b &&
git reset --hard &&
@@ -188,10 +190,6 @@ test_expect_success SANITY 'funny symlink in work tree, un-unlink-able' '
'
-# clean-up from the above test
-chmod a+w a 2>/dev/null
-rm -fr a b
-
test_expect_success 'D/F setup' '
git reset --hard &&