t5505: modernize and simplify hard-to-digest test
This test uses a subshell within a subshell but is formatted in such a way as to suggests that the inner subshell is a sibling rather than a child, which makes it difficult to digest the test's structure and intent. Worse, the inner subshell performs cleanup of actions from earlier in the test, however, a failure between the initial actions and the cleanup will prevent the cleanup from taking place. Fix these problems by modernizing and simplifying the test and by using test_when_finished() for the cleanup action. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
fb23bd7af2
commit
431f4a26b5
@ -348,17 +348,13 @@ URL: $(pwd)/one
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_expect_success 'prune --dry-run' '
|
test_expect_success 'prune --dry-run' '
|
||||||
(
|
git -C one branch -m side2 side &&
|
||||||
cd one &&
|
test_when_finished "git -C one branch -m side side2" &&
|
||||||
git branch -m side2 side) &&
|
|
||||||
(
|
(
|
||||||
cd test &&
|
cd test &&
|
||||||
git remote prune --dry-run origin >output &&
|
git remote prune --dry-run origin >output &&
|
||||||
git rev-parse refs/remotes/origin/side2 &&
|
git rev-parse refs/remotes/origin/side2 &&
|
||||||
test_must_fail git rev-parse refs/remotes/origin/side &&
|
test_must_fail git rev-parse refs/remotes/origin/side &&
|
||||||
(
|
|
||||||
cd ../one &&
|
|
||||||
git branch -m side side2) &&
|
|
||||||
test_i18ncmp expect output
|
test_i18ncmp expect output
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
Reference in New Issue
Block a user