提交 c545bc62 编写于 作者: J John Keeping 提交者: Junio C Hamano

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: NJohn Keeping <john@keeping.me.uk>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 1a9a23e3
...@@ -242,13 +242,6 @@ clean_mark () { ...@@ -242,13 +242,6 @@ clean_mark () {
sort >$(basename "$1") sort >$(basename "$1")
} }
cmp_marks () {
test_when_finished "rm -rf git.marks testgit.marks" &&
clean_mark ".git/testgit/$1/git.marks" &&
clean_mark ".git/testgit/$1/testgit.marks" &&
test_cmp git.marks testgit.marks
}
test_expect_success 'proper failure checks for fetching' ' test_expect_success 'proper failure checks for fetching' '
(cd local && (cd local &&
test_must_fail env GIT_REMOTE_TESTGIT_FAILURE=1 git fetch 2>error && 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' ' ...@@ -258,12 +251,15 @@ test_expect_success 'proper failure checks for fetching' '
' '
test_expect_success 'proper failure checks for pushing' ' test_expect_success 'proper failure checks for pushing' '
test_when_finished "rm -rf local/git.marks local/testgit.marks" &&
(cd local && (cd local &&
git checkout -b crash master && git checkout -b crash master &&
echo crash >>file && echo crash >>file &&
git commit -a -m crash && git commit -a -m crash &&
test_must_fail env GIT_REMOTE_TESTGIT_FAILURE=1 git push --all && test_must_fail env GIT_REMOTE_TESTGIT_FAILURE=1 git push --all &&
cmp_marks origin clean_mark ".git/testgit/origin/git.marks" &&
clean_mark ".git/testgit/origin/testgit.marks" &&
test_cmp git.marks testgit.marks
) )
' '
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册