diff options
Diffstat (limited to 't/t6416-recursive-corner-cases.sh')
-rwxr-xr-x | t/t6416-recursive-corner-cases.sh | 200 |
1 files changed, 140 insertions, 60 deletions
diff --git a/t/t6416-recursive-corner-cases.sh b/t/t6416-recursive-corner-cases.sh index fd98989b14..887c2195a9 100755 --- a/t/t6416-recursive-corner-cases.sh +++ b/t/t6416-recursive-corner-cases.sh @@ -3,6 +3,7 @@ test_description='recursive merge corner cases involving criss-cross merges' . ./test-lib.sh +. "$TEST_DIRECTORY"/lib-merge.sh # # L1 L2 @@ -537,9 +538,15 @@ test_expect_success 'setup differently handled merges of directory/file conflict git checkout B^0 && test_must_fail git merge C^0 && - git clean -fd && - git rm -rf a/ && - git rm a && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git rm -rf a/ && + git rm a~HEAD + else + git clean -fd && + git rm -rf a/ && + git rm a + fi && git cat-file -p B:a >a2 && git add a2 && git commit -m D2 && @@ -558,7 +565,12 @@ test_expect_success 'setup differently handled merges of directory/file conflict git checkout C^0 && test_must_fail git merge B^0 && - git clean -fd && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git rm a~B^0 + else + git clean -fd + fi && git rm -rf a/ && test_write_lines 1 2 3 4 5 6 7 8 >a && git add a && @@ -567,9 +579,15 @@ test_expect_success 'setup differently handled merges of directory/file conflict git checkout C^0 && test_must_fail git merge B^0 && - git clean -fd && - git rm -rf a/ && - git rm a && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git rm -rf a/ && + git rm a~B^0 + else + git clean -fd && + git rm -rf a/ && + git rm a + fi && test_write_lines 1 2 3 4 5 6 7 8 >a2 && git add a2 && git commit -m E4 && @@ -587,18 +605,34 @@ test_expect_success 'merge of D1 & E1 fails but has appropriate contents' ' test_must_fail git merge -s recursive E1^0 && - git ls-files -s >out && - test_line_count = 2 out && - git ls-files -u >out && - test_line_count = 1 out && - git ls-files -o >out && - test_line_count = 1 out && - - git rev-parse >expect \ - A:ignore-me B:a && - git rev-parse >actual \ - :0:ignore-me :2:a && - test_cmp expect actual + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git ls-files -s >out && + test_line_count = 3 out && + git ls-files -u >out && + test_line_count = 2 out && + git ls-files -o >out && + test_line_count = 1 out && + + git rev-parse >expect \ + A:ignore-me B:a D1:a && + git rev-parse >actual \ + :0:ignore-me :1:a :2:a && + test_cmp expect actual + else + git ls-files -s >out && + test_line_count = 2 out && + git ls-files -u >out && + test_line_count = 1 out && + git ls-files -o >out && + test_line_count = 1 out && + + git rev-parse >expect \ + A:ignore-me B:a && + git rev-parse >actual \ + :0:ignore-me :2:a && + test_cmp expect actual + fi ) ' @@ -612,18 +646,34 @@ test_expect_success 'merge of E1 & D1 fails but has appropriate contents' ' test_must_fail git merge -s recursive D1^0 && - git ls-files -s >out && - test_line_count = 2 out && - git ls-files -u >out && - test_line_count = 1 out && - git ls-files -o >out && - test_line_count = 1 out && - - git rev-parse >expect \ - A:ignore-me B:a && - git rev-parse >actual \ - :0:ignore-me :3:a && - test_cmp expect actual + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git ls-files -s >out && + test_line_count = 3 out && + git ls-files -u >out && + test_line_count = 2 out && + git ls-files -o >out && + test_line_count = 1 out && + + git rev-parse >expect \ + A:ignore-me B:a D1:a && + git rev-parse >actual \ + :0:ignore-me :1:a :3:a && + test_cmp expect actual + else + git ls-files -s >out && + test_line_count = 2 out && + git ls-files -u >out && + test_line_count = 1 out && + git ls-files -o >out && + test_line_count = 1 out && + + git rev-parse >expect \ + A:ignore-me B:a && + git rev-parse >actual \ + :0:ignore-me :3:a && + test_cmp expect actual + fi ) ' @@ -637,17 +687,32 @@ test_expect_success 'merge of D1 & E2 fails but has appropriate contents' ' test_must_fail git merge -s recursive E2^0 && - git ls-files -s >out && - test_line_count = 4 out && - git ls-files -u >out && - test_line_count = 3 out && - git ls-files -o >out && - test_line_count = 2 out && - - git rev-parse >expect \ - B:a E2:a/file C:a/file A:ignore-me && - git rev-parse >actual \ - :2:a :3:a/file :1:a/file :0:ignore-me && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git ls-files -s >out && + test_line_count = 5 out && + git ls-files -u >out && + test_line_count = 4 out && + git ls-files -o >out && + test_line_count = 1 out && + + git rev-parse >expect \ + B:a D1:a E2:a/file C:a/file A:ignore-me && + git rev-parse >actual \ + :1:a~HEAD :2:a~HEAD :3:a/file :1:a/file :0:ignore-me + else + git ls-files -s >out && + test_line_count = 4 out && + git ls-files -u >out && + test_line_count = 3 out && + git ls-files -o >out && + test_line_count = 2 out && + + git rev-parse >expect \ + B:a E2:a/file C:a/file A:ignore-me && + git rev-parse >actual \ + :2:a :3:a/file :1:a/file :0:ignore-me + fi && test_cmp expect actual && test_path_is_file a~HEAD @@ -664,17 +729,32 @@ test_expect_success 'merge of E2 & D1 fails but has appropriate contents' ' test_must_fail git merge -s recursive D1^0 && - git ls-files -s >out && - test_line_count = 4 out && - git ls-files -u >out && - test_line_count = 3 out && - git ls-files -o >out && - test_line_count = 2 out && - - git rev-parse >expect \ - B:a E2:a/file C:a/file A:ignore-me && - git rev-parse >actual \ - :3:a :2:a/file :1:a/file :0:ignore-me && + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + git ls-files -s >out && + test_line_count = 5 out && + git ls-files -u >out && + test_line_count = 4 out && + git ls-files -o >out && + test_line_count = 1 out && + + git rev-parse >expect \ + B:a D1:a E2:a/file C:a/file A:ignore-me && + git rev-parse >actual \ + :1:a~D1^0 :3:a~D1^0 :2:a/file :1:a/file :0:ignore-me + else + git ls-files -s >out && + test_line_count = 4 out && + git ls-files -u >out && + test_line_count = 3 out && + git ls-files -o >out && + test_line_count = 2 out && + + git rev-parse >expect \ + B:a E2:a/file C:a/file A:ignore-me && + git rev-parse >actual \ + :3:a :2:a/file :1:a/file :0:ignore-me + fi && test_cmp expect actual && test_path_is_file a~D1^0 @@ -706,7 +786,7 @@ test_expect_success 'merge of D1 & E3 succeeds' ' ) ' -test_expect_success 'merge of D1 & E4 notifies user a and a2 are related' ' +test_expect_merge_algorithm failure success 'merge of D1 & E4 puts merge of a and a2 in both a and a2' ' test_when_finished "git -C directory-file reset --hard" && test_when_finished "git -C directory-file clean -fdqx" && ( @@ -724,7 +804,7 @@ test_expect_success 'merge of D1 & E4 notifies user a and a2 are related' ' test_line_count = 1 out && git rev-parse >expect \ - A:ignore-me B:a D1:a E4:a2 && + A:ignore-me B:a E4:a2 E4:a2 && git rev-parse >actual \ :0:ignore-me :1:a~Temporary\ merge\ branch\ 2 :2:a :3:a2 && test_cmp expect actual @@ -1069,7 +1149,7 @@ test_expect_success 'setup symlink modify/modify' ' ) ' -test_expect_failure 'check symlink modify/modify' ' +test_expect_merge_algorithm failure success 'check symlink modify/modify' ' ( cd symlink-modify-modify && @@ -1135,7 +1215,7 @@ test_expect_success 'setup symlink add/add' ' ) ' -test_expect_failure 'check symlink add/add' ' +test_expect_merge_algorithm failure success 'check symlink add/add' ' ( cd symlink-add-add && @@ -1223,7 +1303,7 @@ test_expect_success 'setup submodule modify/modify' ' ) ' -test_expect_failure 'check submodule modify/modify' ' +test_expect_merge_algorithm failure success 'check submodule modify/modify' ' ( cd submodule-modify-modify && @@ -1311,7 +1391,7 @@ test_expect_success 'setup submodule add/add' ' ) ' -test_expect_failure 'check submodule add/add' ' +test_expect_merge_algorithm failure success 'check submodule add/add' ' ( cd submodule-add-add && @@ -1386,7 +1466,7 @@ test_expect_success 'setup conflicting entry types (submodule vs symlink)' ' ) ' -test_expect_failure 'check conflicting entry types (submodule vs symlink)' ' +test_expect_merge_algorithm failure success 'check conflicting entry types (submodule vs symlink)' ' ( cd submodule-symlink-add-add && |