@matheusbsbs / matheus-bagliano / commits / c545bc6266
Fork 0

t5801: don't use test_when_finished in a subshell

test_when_finished has no effect in a subshell. Since the cmp_marks function is only used once, inline it at its call site and move the test_when_finished invocation to the start of the test. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>

John Keeping committed Sep 5, 2015 at 14:12 UTC c545bc6266e36fdb798cf79fd1f7ef9f39791a94
1 file changed +4 -8
t/t5801-remote-helpers.sh
+4 -8
@@ -242,13 +242,6 @@ clean_mark () {
242 sort >$(basename "$1")
243 }
244
245 -cmp_marks () {
246 - test_when_finished "rm -rf git.marks testgit.marks" &&
247 - clean_mark ".git/testgit/$1/git.marks" &&
248 - clean_mark ".git/testgit/$1/testgit.marks" &&
249 - test_cmp git.marks testgit.marks
250 -}
251 -
245 test_expect_success 'proper failure checks for fetching' '
246 (cd local &&
247 test_must_fail env GIT_REMOTE_TESTGIT_FAILURE=1 git fetch 2>error &&
@@ -258,12 +251,15 @@ test_expect_success 'proper failure checks for fetching' '
251 '
252
253 test_expect_success 'proper failure checks for pushing' '
254 + test_when_finished "rm -rf local/git.marks local/testgit.marks" &&
255 (cd local &&
256 git checkout -b crash master &&
257 echo crash >>file &&
258 git commit -a -m crash &&
259 test_must_fail env GIT_REMOTE_TESTGIT_FAILURE=1 git push --all &&
266 - cmp_marks origin
260 + clean_mark ".git/testgit/origin/git.marks" &&
261 + clean_mark ".git/testgit/origin/testgit.marks" &&
262 + test_cmp git.marks testgit.marks
263 )
264 '
265