t6036: prefer test_when_finished to manual cleanup in following test
Manually cleaning up from former tests in subsequent ones breaks the ability to select which tests we want to run. Use test_when_finished to avoid this problem. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren committed
May 24, 2018 at 00:04 UTC
d43eba0ab5538bd9327b1e3c9ed00abb1c5b558d
1 file changed
+12
-10
t/t6036-recursive-corner-cases.sh
+12
-10
@@ -4,12 +4,6 @@ test_description='recursive merge corner cases involving criss-cross merges'
4
5
. ./test-lib.sh
6
7
-get_clean_checkout () {
8
- git reset --hard &&
9
- git clean -fdqx &&
10
- git checkout "$1"
11
-}
12
-
7
#
8
# L1 L2
9
# o---o
@@ -445,10 +439,12 @@ test_expect_success 'setup differently handled merges of directory/file conflict
439
'
440
441
test_expect_success 'merge of D & E1 fails but has appropriate contents' '
442
+ test_when_finished "git -C directory-file reset --hard" &&
443
+ test_when_finished "git -C directory-file clean -fdqx" &&
444
(
445
cd directory-file &&
446
451
- get_clean_checkout D^0 &&
447
+ git checkout D^0 &&
448
449
test_must_fail git merge -s recursive E1^0 &&
450
@@ -468,10 +464,12 @@ test_expect_success 'merge of D & E1 fails but has appropriate contents' '
464
'
465
466
test_expect_success 'merge of E1 & D fails but has appropriate contents' '
467
+ test_when_finished "git -C directory-file reset --hard" &&
468
+ test_when_finished "git -C directory-file clean -fdqx" &&
469
(
470
cd directory-file &&
471
474
- get_clean_checkout E1^0 &&
472
+ git checkout E1^0 &&
473
474
test_must_fail git merge -s recursive D^0 &&
475
@@ -491,10 +489,12 @@ test_expect_success 'merge of E1 & D fails but has appropriate contents' '
489
'
490
491
test_expect_success 'merge of D & E2 fails but has appropriate contents' '
492
+ test_when_finished "git -C directory-file reset --hard" &&
493
+ test_when_finished "git -C directory-file clean -fdqx" &&
494
(
495
cd directory-file &&
496
497
- get_clean_checkout D^0 &&
497
+ git checkout D^0 &&
498
499
test_must_fail git merge -s recursive E2^0 &&
500
@@ -516,10 +516,12 @@ test_expect_success 'merge of D & E2 fails but has appropriate contents' '
516
'
517
518
test_expect_success 'merge of E2 & D fails but has appropriate contents' '
519
+ test_when_finished "git -C directory-file reset --hard" &&
520
+ test_when_finished "git -C directory-file clean -fdqx" &&
521
(
522
cd directory-file &&
523
522
- get_clean_checkout E2^0 &&
524
+ git checkout E2^0 &&
525
526
test_must_fail git merge -s recursive D^0 &&
527