t/: new helper for tests that pass with ort but fail with recursive

There are a number of tests that the "recursive" backend does not handle correctly but which the redesign in "ort" will. Add a new helper in lib-merge.sh for selecting a different test expectation based on the setting of GIT_TEST_MERGE_ALGORITHM, and use it in various testcases to document which ones we expect to fail under recursive but pass under ort. 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 f06481f12732e846c0572a0109e2c5b5684f508a
6 files changed +34 -16
t/lib-merge.sh new
+13
@@ -0,0 +1,13 @@
1 +# Helper functions used by merge tests.
2 +
3 +test_expect_merge_algorithm () {
4 + status_for_recursive=$1 status_for_ort=$2
5 + shift 2
6 +
7 + if test "$GIT_TEST_MERGE_ALGORITHM" = ort
8 + then
9 + test_expect_${status_for_ort} "$@"
10 + else
11 + test_expect_${status_for_recursive} "$@"
12 + fi
13 +}
t/t6416-recursive-corner-cases.sh
+6 -5
@@ -3,6 +3,7 @@
3 test_description='recursive merge corner cases involving criss-cross merges'
4
5 . ./test-lib.sh
6 +. "$TEST_DIRECTORY"/lib-merge.sh
7
8 #
9 # L1 L2
@@ -1069,7 +1070,7 @@ test_expect_success 'setup symlink modify/modify' '
1070 )
1071 '
1072
1072 -test_expect_failure 'check symlink modify/modify' '
1073 +test_expect_merge_algorithm failure success 'check symlink modify/modify' '
1074 (
1075 cd symlink-modify-modify &&
1076
@@ -1135,7 +1136,7 @@ test_expect_success 'setup symlink add/add' '
1136 )
1137 '
1138
1138 -test_expect_failure 'check symlink add/add' '
1139 +test_expect_merge_algorithm failure success 'check symlink add/add' '
1140 (
1141 cd symlink-add-add &&
1142
@@ -1223,7 +1224,7 @@ test_expect_success 'setup submodule modify/modify' '
1224 )
1225 '
1226
1226 -test_expect_failure 'check submodule modify/modify' '
1227 +test_expect_merge_algorithm failure success 'check submodule modify/modify' '
1228 (
1229 cd submodule-modify-modify &&
1230
@@ -1311,7 +1312,7 @@ test_expect_success 'setup submodule add/add' '
1312 )
1313 '
1314
1314 -test_expect_failure 'check submodule add/add' '
1315 +test_expect_merge_algorithm failure success 'check submodule add/add' '
1316 (
1317 cd submodule-add-add &&
1318
@@ -1386,7 +1387,7 @@ test_expect_success 'setup conflicting entry types (submodule vs symlink)' '
1387 )
1388 '
1389
1389 -test_expect_failure 'check conflicting entry types (submodule vs symlink)' '
1390 +test_expect_merge_algorithm failure success 'check conflicting entry types (submodule vs symlink)' '
1391 (
1392 cd submodule-symlink-add-add &&
1393
t/t6422-merge-rename-corner-cases.sh
+4 -3
@@ -4,6 +4,7 @@ test_description="recursive merge corner cases w/ renames but not criss-crosses"
4 # t6036 has corner cases that involve both criss-cross merges and renames
5
6 . ./test-lib.sh
7 +. "$TEST_DIRECTORY"/lib-merge.sh
8
9 test_setup_rename_delete_untracked () {
10 test_create_repo rename-delete-untracked &&
@@ -878,7 +879,7 @@ test_setup_rad () {
879 )
880 }
881
881 -test_expect_failure 'rad-check: rename/add/delete conflict' '
882 +test_expect_merge_algorithm failure success 'rad-check: rename/add/delete conflict' '
883 test_setup_rad &&
884 (
885 cd rad &&
@@ -951,7 +952,7 @@ test_setup_rrdd () {
952 )
953 }
954
954 -test_expect_failure 'rrdd-check: rename/rename(2to1)/delete/delete conflict' '
955 +test_expect_merge_algorithm failure success 'rrdd-check: rename/rename(2to1)/delete/delete conflict' '
956 test_setup_rrdd &&
957 (
958 cd rrdd &&
@@ -1040,7 +1041,7 @@ test_setup_mod6 () {
1041 )
1042 }
1043
1043 -test_expect_failure 'mod6-check: chains of rename/rename(1to2) and rename/rename(2to1)' '
1044 +test_expect_merge_algorithm failure success 'mod6-check: chains of rename/rename(1to2) and rename/rename(2to1)' '
1045 test_setup_mod6 &&
1046 (
1047 cd mod6 &&
t/t6423-merge-rename-directories.sh
+7 -6
@@ -26,6 +26,7 @@ test_description="recursive merge with directory renames"
26 # files that might be renamed into each other's paths.)
27
28 . ./test-lib.sh
29 +. "$TEST_DIRECTORY"/lib-merge.sh
30
31
32 ###########################################################################
@@ -1339,7 +1340,7 @@ test_setup_6b1 () {
1340 )
1341 }
1342
1342 -test_expect_failure '6b1: Same renames done on both sides, plus another rename' '
1343 +test_expect_merge_algorithm failure success '6b1: Same renames done on both sides, plus another rename' '
1344 test_setup_6b1 &&
1345 (
1346 cd 6b1 &&
@@ -1412,7 +1413,7 @@ test_setup_6b2 () {
1413 )
1414 }
1415
1415 -test_expect_failure '6b2: Same rename done on both sides' '
1416 +test_expect_merge_algorithm failure success '6b2: Same rename done on both sides' '
1417 test_setup_6b2 &&
1418 (
1419 cd 6b2 &&
@@ -3471,7 +3472,7 @@ test_setup_10e () {
3472 )
3473 }
3474
3474 -test_expect_failure '10e: Does git complain about untracked file that is not really in the way?' '
3475 +test_expect_merge_algorithm failure success '10e: Does git complain about untracked file that is not really in the way?' '
3476 test_setup_10e &&
3477 (
3478 cd 10e &&
@@ -4104,7 +4105,7 @@ test_setup_12b1 () {
4105 )
4106 }
4107
4107 -test_expect_failure '12b1: Moving two directory hierarchies into each other' '
4108 +test_expect_merge_algorithm failure success '12b1: Moving two directory hierarchies into each other' '
4109 test_setup_12b1 &&
4110 (
4111 cd 12b1 &&
@@ -4272,7 +4273,7 @@ test_setup_12c1 () {
4273 )
4274 }
4275
4275 -test_expect_failure '12c1: Moving one directory hierarchy into another w/ content merge' '
4276 +test_expect_merge_algorithm failure success '12c1: Moving one directory hierarchy into another w/ content merge' '
4277 test_setup_12c1 &&
4278 (
4279 cd 12c1 &&
@@ -4632,7 +4633,7 @@ test_setup_12f () {
4633 )
4634 }
4635
4635 -test_expect_failure '12f: Trivial directory resolve, caching, all kinds of fun' '
4636 +test_expect_merge_algorithm failure success '12f: Trivial directory resolve, caching, all kinds of fun' '
4637 test_setup_12f &&
4638 (
4639 cd 12f &&
t/t6426-merge-skip-unneeded-updates.sh
+2 -1
@@ -23,6 +23,7 @@ test_description="merge cases"
23 # files that might be renamed into each other's paths.)
24
25 . ./test-lib.sh
26 +. "$TEST_DIRECTORY"/lib-merge.sh
27
28
29 ###########################################################################
@@ -666,7 +667,7 @@ test_setup_4a () {
667 # correct requires doing the merge in-memory first, then realizing that no
668 # updates to the file are necessary, and thus that we can just leave the path
669 # alone.
669 -test_expect_failure '4a: Change on A, change on B subset of A, dirty mods present' '
670 +test_expect_merge_algorithm failure success '4a: Change on A, change on B subset of A, dirty mods present' '
671 test_setup_4a &&
672 (
673 cd 4a &&
t/t6430-merge-recursive.sh
+2 -1
@@ -3,6 +3,7 @@
3 test_description='merge-recursive backend test'
4
5 . ./test-lib.sh
6 +. "$TEST_DIRECTORY"/lib-merge.sh
7
8 test_expect_success 'setup 1' '
9
@@ -641,7 +642,7 @@ test_expect_success 'merge-recursive copy vs. rename' '
642 test_cmp expected actual
643 '
644
644 -test_expect_failure 'merge-recursive rename vs. rename/symlink' '
645 +test_expect_merge_algorithm failure success 'merge-recursive rename vs. rename/symlink' '
646
647 git checkout -f rename &&
648 git merge rename-ln &&