merge tests: expect slight differences in output for recursive vs. ort
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>
Elijah Newren committed
Oct 26, 2020 at 17:01 UTC
c8c35f6a02f3841d4383a5ce4c9d8e426776d151
3 files changed
+39
-6
t/t6402-merge-rename.sh
+12
-2
@@ -320,7 +320,12 @@ test_expect_success 'Rename+D/F conflict; renamed file merges but dir in way' '
320
321
test_i18ngrep "CONFLICT (modify/delete): dir/file-in-the-way" output &&
322
test_i18ngrep "Auto-merging dir" output &&
323
- test_i18ngrep "Adding as dir~HEAD instead" output &&
323
+ if test "$GIT_TEST_MERGE_ALGORITHM" = ort
324
+ then
325
+ test_i18ngrep "moving it to dir~HEAD instead" output
326
+ else
327
+ test_i18ngrep "Adding as dir~HEAD instead" output
328
+ fi &&
329
330
test 3 -eq "$(git ls-files -u | wc -l)" &&
331
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' '
347
! grep "error: refusing to lose untracked file at" errors &&
348
test_i18ngrep "CONFLICT (modify/delete): dir/file-in-the-way" output &&
349
test_i18ngrep "Auto-merging dir" output &&
345
- test_i18ngrep "Adding as dir~renamed-file-has-no-conflicts instead" output &&
350
+ if test "$GIT_TEST_MERGE_ALGORITHM" = ort
351
+ then
352
+ test_i18ngrep "moving it to dir~renamed-file-has-no-conflicts instead" output
353
+ else
354
+ test_i18ngrep "Adding as dir~renamed-file-has-no-conflicts instead" output
355
+ fi &&
356
357
test 3 -eq "$(git ls-files -u | wc -l)" &&
358
test 2 -eq "$(git ls-files -u dir/file-in-the-way | wc -l)" &&
t/t6437-submodule-merge.sh
+21
-4
@@ -127,7 +127,12 @@ test_expect_success 'merging should conflict for non fast-forward' '
127
git checkout -b test-nonforward b &&
128
(cd sub &&
129
git rev-parse sub-d > ../expect) &&
130
- test_must_fail git merge c 2> actual &&
130
+ if test "$GIT_TEST_MERGE_ALGORITHM" = ort
131
+ then
132
+ test_must_fail git merge c >actual
133
+ else
134
+ test_must_fail git merge c 2> actual
135
+ fi &&
136
grep $(cat expect) actual > /dev/null &&
137
git reset --hard)
138
'
@@ -138,9 +143,21 @@ test_expect_success 'merging should fail for ambiguous common parent' '
143
(cd sub &&
144
git checkout -b ambiguous sub-b &&
145
git merge sub-c &&
141
- git rev-parse sub-d > ../expect1 &&
142
- git rev-parse ambiguous > ../expect2) &&
143
- test_must_fail git merge c 2> actual &&
146
+ if test "$GIT_TEST_MERGE_ALGORITHM" = ort
147
+ then
148
+ git rev-parse --short sub-d >../expect1 &&
149
+ git rev-parse --short ambiguous >../expect2
150
+ else
151
+ git rev-parse sub-d > ../expect1 &&
152
+ git rev-parse ambiguous > ../expect2
153
+ fi
154
+ ) &&
155
+ if test "$GIT_TEST_MERGE_ALGORITHM" = ort
156
+ then
157
+ test_must_fail git merge c >actual
158
+ else
159
+ test_must_fail git merge c 2> actual
160
+ fi &&
161
grep $(cat expect1) actual > /dev/null &&
162
grep $(cat expect2) actual > /dev/null &&
163
git reset --hard)
t/t7602-merge-octopus-many.sh
+6
@@ -77,6 +77,12 @@ Merge made by the 'recursive' strategy.
77
EOF
78
79
test_expect_success 'merge reduces irrelevant remote heads' '
80
+ if test "$GIT_TEST_MERGE_ALGORITHM" = ort
81
+ then
82
+ mv expected expected.tmp &&
83
+ sed s/recursive/ort/ expected.tmp >expected &&
84
+ rm expected.tmp
85
+ fi &&
86
GIT_MERGE_VERBOSITY=0 git merge c4 c5 >actual &&
87
test_i18ncmp expected actual
88
'