]> git.ipfire.org Git - thirdparty/git.git/commitdiff
merge tests: expect slight differences in output for recursive vs. ort
authorElijah Newren <newren@gmail.com>
Mon, 26 Oct 2020 17:01:41 +0000 (17:01 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Oct 2020 19:31:24 +0000 (12:31 -0700)
The ort merge strategy has some slight differences in commit
descriptions (shortened hashes), stdout vs stderr, and in conflict
messages.  Also, builtin/merge.c reports usage of "ort" as "Merge made
by the 'ort' strategy" -- while it is meant as a drop in replacement for
"recursive" it is not yet treated as though it is recursive.  Update the
testcases to expect different output for the different merge backends.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6402-merge-rename.sh
t/t6437-submodule-merge.sh
t/t7602-merge-octopus-many.sh

index 47d4434d64ee9fe9dc11e2d78b2ae8c7ec33f91c..3f64f62224485fec4e192b90dfacacb2c78f3626 100755 (executable)
@@ -320,7 +320,12 @@ test_expect_success 'Rename+D/F conflict; renamed file merges but dir in way' '
 
        test_i18ngrep "CONFLICT (modify/delete): dir/file-in-the-way" output &&
        test_i18ngrep "Auto-merging dir" output &&
-       test_i18ngrep "Adding as dir~HEAD instead" output &&
+       if test "$GIT_TEST_MERGE_ALGORITHM" = ort
+       then
+               test_i18ngrep "moving it to dir~HEAD instead" output
+       else
+               test_i18ngrep "Adding as dir~HEAD instead" output
+       fi &&
 
        test 3 -eq "$(git ls-files -u | wc -l)" &&
        test 2 -eq "$(git ls-files -u dir/file-in-the-way | wc -l)" &&
@@ -342,7 +347,12 @@ test_expect_success 'Same as previous, but merged other way' '
        ! grep "error: refusing to lose untracked file at" errors &&
        test_i18ngrep "CONFLICT (modify/delete): dir/file-in-the-way" output &&
        test_i18ngrep "Auto-merging dir" output &&
-       test_i18ngrep "Adding as dir~renamed-file-has-no-conflicts instead" output &&
+       if test "$GIT_TEST_MERGE_ALGORITHM" = ort
+       then
+               test_i18ngrep "moving it to dir~renamed-file-has-no-conflicts instead" output
+       else
+               test_i18ngrep "Adding as dir~renamed-file-has-no-conflicts instead" output
+       fi &&
 
        test 3 -eq "$(git ls-files -u | wc -l)" &&
        test 2 -eq "$(git ls-files -u dir/file-in-the-way | wc -l)" &&
index 6a1e5f82324877a774fba03e5657654510de994f..3ead2b726f4b3fac9060c53721471858d59c1e4a 100755 (executable)
@@ -127,7 +127,12 @@ test_expect_success 'merging should conflict for non fast-forward' '
         git checkout -b test-nonforward b &&
         (cd sub &&
          git rev-parse sub-d > ../expect) &&
-        test_must_fail git merge c 2> actual  &&
+         if test "$GIT_TEST_MERGE_ALGORITHM" = ort
+         then
+               test_must_fail git merge c >actual
+         else
+               test_must_fail git merge c 2> actual
+         fi &&
         grep $(cat expect) actual > /dev/null &&
         git reset --hard)
 '
@@ -138,9 +143,21 @@ test_expect_success 'merging should fail for ambiguous common parent' '
        (cd sub &&
         git checkout -b ambiguous sub-b &&
         git merge sub-c &&
-        git rev-parse sub-d > ../expect1 &&
-        git rev-parse ambiguous > ../expect2) &&
-       test_must_fail git merge c 2> actual &&
+        if test "$GIT_TEST_MERGE_ALGORITHM" = ort
+        then
+               git rev-parse --short sub-d >../expect1 &&
+               git rev-parse --short ambiguous >../expect2
+        else
+               git rev-parse sub-d > ../expect1 &&
+               git rev-parse ambiguous > ../expect2
+        fi
+        ) &&
+        if test "$GIT_TEST_MERGE_ALGORITHM" = ort
+        then
+               test_must_fail git merge c >actual
+        else
+               test_must_fail git merge c 2> actual
+        fi &&
        grep $(cat expect1) actual > /dev/null &&
        grep $(cat expect2) actual > /dev/null &&
        git reset --hard)
index 6abe441ae3611906143a76ac2b4acca7ab5ff671..13859ec8595f7f5abc32cc5322e83328a4556319 100755 (executable)
@@ -77,6 +77,12 @@ Merge made by the 'recursive' strategy.
 EOF
 
 test_expect_success 'merge reduces irrelevant remote heads' '
+       if test "$GIT_TEST_MERGE_ALGORITHM" = ort
+       then
+               mv expected expected.tmp &&
+               sed s/recursive/ort/ expected.tmp >expected &&
+               rm expected.tmp
+       fi &&
        GIT_MERGE_VERBOSITY=0 git merge c4 c5 >actual &&
        test_i18ncmp expected actual
 '