Skip to content

Commit c545bc6

Browse files
johnkeepinggitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1a9a23e commit c545bc6

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

t/t5801-remote-helpers.sh

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,6 @@ clean_mark () {
242242
sort >$(basename "$1")
243243
}
244244

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-
252245
test_expect_success 'proper failure checks for fetching' '
253246
(cd local &&
254247
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' '
258251
'
259252

260253
test_expect_success 'proper failure checks for pushing' '
254+
test_when_finished "rm -rf local/git.marks local/testgit.marks" &&
261255
(cd local &&
262256
git checkout -b crash master &&
263257
echo crash >>file &&
264258
git commit -a -m crash &&
265259
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
267263
)
268264
'
269265

0 commit comments

Comments
 (0)