t7610: move setup code to the 'setup' test case
authorRichard Hansen <hansenr@google.com>
Tue, 10 Jan 2017 20:41:52 +0000 (15:41 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 10 Jan 2017 21:22:19 +0000 (13:22 -0800)
Multiple test cases depend on these hunks, so move them to the 'setup'
test case. This is a step toward making the tests more independent so
that if one test fails it doesn't cause subsequent tests to fail.

Signed-off-by: Richard Hansen <hansenr@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7610-mergetool.sh
index 780d287ef5fa15f63871cc43ec7685bce89381c7..6a284814bc9b7202c33a1b60200c7e8a4e66039d 100755 (executable)
@@ -55,6 +55,22 @@ test_expect_success 'setup' '
        git rm file12 &&
        git commit -m "branch1 changes" &&
 
+       git checkout -b delete-base branch1 &&
+       mkdir -p a/a &&
+       (echo one; echo two; echo 3; echo 4) >a/a/file.txt &&
+       git add a/a/file.txt &&
+       git commit -m"base file" &&
+       git checkout -b move-to-b delete-base &&
+       mkdir -p b/b &&
+       git mv a/a/file.txt b/b/file.txt &&
+       (echo one; echo two; echo 4) >b/b/file.txt &&
+       git commit -a -m"move to b" &&
+       git checkout -b move-to-c delete-base &&
+       mkdir -p c/c &&
+       git mv a/a/file.txt c/c/file.txt &&
+       (echo one; echo two; echo 3) >c/c/file.txt &&
+       git commit -a -m"move to c" &&
+
        git checkout -b stash1 master &&
        echo stash1 change file11 >file11 &&
        git add file11 &&
@@ -86,6 +102,23 @@ test_expect_success 'setup' '
        git rm file11 &&
        git commit -m "master updates" &&
 
+       git clean -fdx &&
+       git checkout -b order-file-start master &&
+       echo start >a &&
+       echo start >b &&
+       git add a b &&
+       git commit -m start &&
+       git checkout -b order-file-side1 order-file-start &&
+       echo side1 >a &&
+       echo side1 >b &&
+       git add a b &&
+       git commit -m side1 &&
+       git checkout -b order-file-side2 order-file-start &&
+       echo side2 >a &&
+       echo side2 >b &&
+       git add a b &&
+       git commit -m side2 &&
+
        git config merge.tool mytool &&
        git config mergetool.mytool.cmd "cat \"\$REMOTE\" >\"\$MERGED\"" &&
        git config mergetool.mytool.trustExitCode true &&
@@ -244,21 +277,7 @@ test_expect_success 'mergetool takes partial path' '
 '
 
 test_expect_success 'mergetool delete/delete conflict' '
-       git checkout -b delete-base branch1 &&
-       mkdir -p a/a &&
-       (echo one; echo two; echo 3; echo 4) >a/a/file.txt &&
-       git add a/a/file.txt &&
-       git commit -m"base file" &&
-       git checkout -b move-to-b delete-base &&
-       mkdir -p b/b &&
-       git mv a/a/file.txt b/b/file.txt &&
-       (echo one; echo two; echo 4) >b/b/file.txt &&
-       git commit -a -m"move to b" &&
-       git checkout -b move-to-c delete-base &&
-       mkdir -p c/c &&
-       git mv a/a/file.txt c/c/file.txt &&
-       (echo one; echo two; echo 3) >c/c/file.txt &&
-       git commit -a -m"move to c" &&
+       git checkout move-to-c &&
        test_must_fail git merge move-to-b &&
        echo d | git mergetool a/a/file.txt &&
        ! test -f a/a/file.txt &&
@@ -608,26 +627,12 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT
 '
 
 test_expect_success 'diff.orderFile configuration is honored' '
+       git checkout order-file-side2 &&
        test_config diff.orderFile order-file &&
        test_config mergetool.myecho.cmd "echo \"\$LOCAL\"" &&
        test_config mergetool.myecho.trustExitCode true &&
        echo b >order-file &&
        echo a >>order-file &&
-       git checkout -b order-file-start master &&
-       echo start >a &&
-       echo start >b &&
-       git add a b &&
-       git commit -m start &&
-       git checkout -b order-file-side1 order-file-start &&
-       echo side1 >a &&
-       echo side1 >b &&
-       git add a b &&
-       git commit -m side1 &&
-       git checkout -b order-file-side2 order-file-start &&
-       echo side2 >a &&
-       echo side2 >b &&
-       git add a b &&
-       git commit -m side2 &&
        test_must_fail git merge order-file-side1 &&
        cat >expect <<-\EOF &&
                Merging: