]> Kevux Git Server - rit/commitdiff
t6404, t6423: expect improved rename/delete handling in ort backend
authorElijah Newren <newren@gmail.com>
Mon, 26 Oct 2020 17:01:39 +0000 (17:01 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Oct 2020 19:31:24 +0000 (12:31 -0700)
When a file is renamed and has content conflicts, merge-recursive does
not have some stages for the old filename and some stages for the new
filename in the index; instead it copies all the stages corresponding to
the old filename over to the corresponding locations for the new
filename, so that there are three higher order stages all corresponding
to the new filename.  Doing things this way makes it easier for the user
to access the different versions and to resolve the conflict (no need to
manually 'git rm' the old version as well as 'git add' the new one).

rename/deletes should be handled similarly -- there should be two stages
for the renamed file rather than just one.  We do not want to
destabilize merge-recursive right now, so instead update relevant tests
to have different expectations depending on whether the "recursive" or
"ort" merge strategies are in use.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t6404-recursive-merge.sh
t/t6423-merge-rename-directories.sh

index 332cfc5..b1c3d4d 100755 (executable)
@@ -118,12 +118,22 @@ test_expect_success 'mark rename/delete as unmerged' '
        test_tick &&
        git commit -m rename &&
        test_must_fail git merge delete &&
-       test 1 = $(git ls-files --unmerged | wc -l) &&
+       if test "$GIT_TEST_MERGE_ALGORITHM" = ort
+       then
+               test 2 = $(git ls-files --unmerged | wc -l)
+       else
+               test 1 = $(git ls-files --unmerged | wc -l)
+       fi &&
        git rev-parse --verify :2:a2 &&
        test_must_fail git rev-parse --verify :3:a2 &&
        git checkout -f delete &&
        test_must_fail git merge rename &&
-       test 1 = $(git ls-files --unmerged | wc -l) &&
+       if test "$GIT_TEST_MERGE_ALGORITHM" = ort
+       then
+               test 2 = $(git ls-files --unmerged | wc -l)
+       else
+               test 1 = $(git ls-files --unmerged | wc -l)
+       fi &&
        test_must_fail git rev-parse --verify :2:a2 &&
        git rev-parse --verify :3:a2
 '
index 5ea7756..f9a3f24 100755 (executable)
@@ -1271,17 +1271,32 @@ test_expect_success '6a: Tricky rename/delete' '
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
                test_i18ngrep "CONFLICT (rename/delete).*z/c.*y/c" out &&
 
-               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 &&
+               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 >actual \
-                       :0:y/b :3:y/c &&
-               git rev-parse >expect \
-                        O:z/b  O:z/c &&
+                       git rev-parse >actual \
+                               :0:y/b :1:y/c :3:y/c &&
+                       git rev-parse >expect \
+                                O:z/b  O:z/c  O:z/c
+               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 >actual \
+                               :0:y/b :3:y/c &&
+                       git rev-parse >expect \
+                                O:z/b  O:z/c
+               fi &&
                test_cmp expect actual
        )
 '
@@ -1934,17 +1949,32 @@ test_expect_success '7d: transitive rename involved in rename/delete; how is it
                test_must_fail git -c merge.directoryRenames=true merge -s recursive B^0 >out &&
                test_i18ngrep "CONFLICT (rename/delete).*x/d.*y/d" out &&
 
-               git ls-files -s >out &&
-               test_line_count = 3 out &&
-               git ls-files -u >out &&
-               test_line_count = 1 out &&
-               git ls-files -o >out &&
-               test_line_count = 1 out &&
+               if test "$GIT_TEST_MERGE_ALGORITHM" = ort
+               then
+                       git ls-files -s >out &&
+                       test_line_count = 4 out &&
+                       git ls-files -u >out &&
+                       test_line_count = 2 out &&
+                       git ls-files -o >out &&
+                       test_line_count = 1 out &&
 
-               git rev-parse >actual \
-                       :0:y/b :0:y/c :3:y/d &&
-               git rev-parse >expect \
-                        O:z/b  O:z/c  O:x/d &&
+                       git rev-parse >actual \
+                               :0:y/b :0:y/c :1:y/d :3:y/d &&
+                       git rev-parse >expect \
+                                O:z/b  O:z/c  O:x/d  O:x/d
+               else
+                       git ls-files -s >out &&
+                       test_line_count = 3 out &&
+                       git ls-files -u >out &&
+                       test_line_count = 1 out &&
+                       git ls-files -o >out &&
+                       test_line_count = 1 out &&
+
+                       git rev-parse >actual \
+                               :0:y/b :0:y/c :3:y/d &&
+                       git rev-parse >expect \
+                                O:z/b  O:z/c  O:x/d
+               fi &&
                test_cmp expect actual
        )
 '