@matheusbsbs / matheus-bagliano / commits / a1d8b01775
Fork 0

t6422: fix multiple errors with the mod6 test expectations

This test had multiple issues causing it to fail for the wrong reason(s): * rename/rename(1to2) conflicts have always left the original source path present in the working directory and index (at stage 1). Thus, the triple rename/rename(1to2) should result in 9 unstaged files, not 6. * It messed up the three-way content merge for checking the results of merging for one of the renames, accidentally turning it into a two-way merge. * It got the contents of the base files it was using to compare against wrong, due to an off-by-one error, and overwrite-redirection ('>') instead of append-redirection ('>>'). * It used slightly too-long conflict markers * It didn't include filenames in the conflict marker hunks (granted, that was a shortcoming of the merge-recursive backend for rename/add and rename/rename(2to1) conflicts, but since it's test_expect_failure anyway we might as well make it expect our preferred behavior rather than some compromise that we can't yet reach anyway). Fix these issues so that a merge backend which correctly handles these kinds of nested conflicts will pass the test. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Aug 10, 2020 at 22:29 UTC a1d8b01775d3dec8b641974821fe512be7fef2bb
1 file changed +10 -9
t/t6422-merge-rename-corner-cases.sh
+10 -9
@@ -1042,25 +1042,25 @@ test_expect_failure 'mod6-check: chains of rename/rename(1to2) and rename/rename
1042 test_must_be_empty err &&
1043
1044 git ls-files -s >file_count &&
1045 - test_line_count = 6 file_count &&
1045 + test_line_count = 9 file_count &&
1046 git ls-files -u >file_count &&
1047 - test_line_count = 6 file_count &&
1047 + test_line_count = 9 file_count &&
1048 git ls-files -o >file_count &&
1049 test_line_count = 3 file_count &&
1050
1051 test_seq 10 20 >merged-one &&
1052 test_seq 51 60 >merged-five &&
1053 # Determine what the merge of three would give us.
1054 - test_seq 30 40 >three-side-A &&
1054 + test_seq 31 39 >three-base &&
1055 + test_seq 31 40 >three-side-A &&
1056 test_seq 31 39 >three-side-B &&
1056 - echo forty >three-side-B &&
1057 - >empty &&
1057 + echo forty >>three-side-B &&
1058 test_must_fail git merge-file \
1059 - -L "HEAD" \
1059 + -L "HEAD:four" \
1060 -L "" \
1061 - -L "B^0" \
1062 - three-side-A empty three-side-B &&
1063 - sed -e "s/^\([<=>]\)/\1\1\1/" three-side-A >merged-three &&
1061 + -L "B^0:two" \
1062 + three-side-A three-base three-side-B &&
1063 + sed -e "s/^\([<=>]\)/\1\1/" three-side-A >merged-three &&
1064
1065 # Verify the index is as expected
1066 git rev-parse >actual \
@@ -1075,6 +1075,7 @@ test_expect_failure 'mod6-check: chains of rename/rename(1to2) and rename/rename
1075
1076 git cat-file -p :2:two >expect &&
1077 git cat-file -p :3:two >other &&
1078 + >empty &&
1079 test_must_fail git merge-file \
1080 -L "HEAD" -L "" -L "B^0" \
1081 expect empty other &&