summaryrefslogtreecommitdiff
path: root/t/t6036-recursive-corner-cases.sh
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2018-05-24 07:04:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-28 06:09:02 (GMT)
commitd43eba0ab5538bd9327b1e3c9ed00abb1c5b558d (patch)
treeac2456a685aa9c2fed7fd85108f7911ece396728 /t/t6036-recursive-corner-cases.sh
parent6ac767e5c00a53a41460e3202fcce9e5b5b76c55 (diff)
downloadgit-d43eba0ab5538bd9327b1e3c9ed00abb1c5b558d.zip
git-d43eba0ab5538bd9327b1e3c9ed00abb1c5b558d.tar.gz
git-d43eba0ab5538bd9327b1e3c9ed00abb1c5b558d.tar.bz2
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>
Diffstat (limited to 't/t6036-recursive-corner-cases.sh')
-rwxr-xr-xt/t6036-recursive-corner-cases.sh22
1 files changed, 12 insertions, 10 deletions
diff --git a/t/t6036-recursive-corner-cases.sh b/t/t6036-recursive-corner-cases.sh
index e5f167a..b562130 100755
--- a/t/t6036-recursive-corner-cases.sh
+++ b/t/t6036-recursive-corner-cases.sh
@@ -4,12 +4,6 @@ test_description='recursive merge corner cases involving criss-cross merges'
. ./test-lib.sh
-get_clean_checkout () {
- git reset --hard &&
- git clean -fdqx &&
- git checkout "$1"
-}
-
#
# L1 L2
# o---o
@@ -445,10 +439,12 @@ test_expect_success 'setup differently handled merges of directory/file conflict
'
test_expect_success 'merge of D & E1 fails but has appropriate contents' '
+ test_when_finished "git -C directory-file reset --hard" &&
+ test_when_finished "git -C directory-file clean -fdqx" &&
(
cd directory-file &&
- get_clean_checkout D^0 &&
+ git checkout D^0 &&
test_must_fail git merge -s recursive E1^0 &&
@@ -468,10 +464,12 @@ test_expect_success 'merge of D & E1 fails but has appropriate contents' '
'
test_expect_success 'merge of E1 & D fails but has appropriate contents' '
+ test_when_finished "git -C directory-file reset --hard" &&
+ test_when_finished "git -C directory-file clean -fdqx" &&
(
cd directory-file &&
- get_clean_checkout E1^0 &&
+ git checkout E1^0 &&
test_must_fail git merge -s recursive D^0 &&
@@ -491,10 +489,12 @@ test_expect_success 'merge of E1 & D fails but has appropriate contents' '
'
test_expect_success 'merge of D & E2 fails but has appropriate contents' '
+ test_when_finished "git -C directory-file reset --hard" &&
+ test_when_finished "git -C directory-file clean -fdqx" &&
(
cd directory-file &&
- get_clean_checkout D^0 &&
+ git checkout D^0 &&
test_must_fail git merge -s recursive E2^0 &&
@@ -516,10 +516,12 @@ test_expect_success 'merge of D & E2 fails but has appropriate contents' '
'
test_expect_success 'merge of E2 & D fails but has appropriate contents' '
+ test_when_finished "git -C directory-file reset --hard" &&
+ test_when_finished "git -C directory-file clean -fdqx" &&
(
cd directory-file &&
- get_clean_checkout E2^0 &&
+ git checkout E2^0 &&
test_must_fail git merge -s recursive D^0 &&