t3600: clean up permissions test properly

The test of failing `git rm -f` removes the write permissions on the test directory, but fails to restore them if the test fails. This means that the test temporary directory cannot be cleaned up, which means that subsequent attempts to run the test fail mysteriously. Instead, do the cleanup in a `test_when_finished` block so that it can't be skipped. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed May 22, 2017 at 16:17 UTC 23739aa2b3d2546c3b3ff0e06eb5171b37e31a90
1 file changed +2 -2
t/t3600-rm.sh
+2 -2
@@ -97,9 +97,9 @@ test_expect_success FUNNYNAMES \
97 embedded'"
98
99 test_expect_success SANITY 'Test that "git rm -f" fails if its rm fails' '
100 + test_when_finished "chmod 775 ." &&
101 chmod a-w . &&
101 - test_must_fail git rm -f baz &&
102 - chmod 775 .
102 + test_must_fail git rm -f baz
103 '
104
105 test_expect_success \