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>
Eric Sunshine committed
Jul 1, 2018 at 20:23 UTC
431f4a26b5a8371de64776028ea511c79f74296a
1 file changed
+2
-6
t/t5505-remote.sh
+2
-6
@@ -348,17 +348,13 @@ URL: $(pwd)/one
348
EOF
349
350
test_expect_success 'prune --dry-run' '
351
- (
352
- cd one &&
353
- git branch -m side2 side) &&
351
+ git -C one branch -m side2 side &&
352
+ test_when_finished "git -C one branch -m side side2" &&
353
(
354
cd test &&
355
git remote prune --dry-run origin >output &&
356
git rev-parse refs/remotes/origin/side2 &&
357
test_must_fail git rev-parse refs/remotes/origin/side &&
359
- (
360
- cd ../one &&
361
- git branch -m side side2) &&
358
test_i18ncmp expect output
359
)
360
'