t6423: rename file within directory that other side renamed

Add a new testcase where one side of history renames: olddir/ -> newdir/ and the other side of history renames: olddir/a -> olddir/alpha When using merge.directoryRenames=true, it seems logical to expect the file to end up at newdir/alpha. Unfortunately, both merge-recursive and merge-ort currently see this as a rename/rename conflict: olddir/a -> newdir/a vs. olddir/a -> newdir/alpha Suggesting that there's some extra logic we probably want to add somewhere to allow this case to run without triggering a conflict. For now simply document this known issue. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed May 4, 2021 at 02:12 UTC 15f3e1e05683ce710f22d9b1ef0f6b849f1d4b36
1 file changed +58
t/t6423-merge-rename-directories.sh
+58
@@ -4966,6 +4966,64 @@ test_expect_success '12g: Testcase with two kinds of "relevant" renames' '
4966 )
4967 '
4968
4969 +# Testcase 12h, Testcase with two kinds of "relevant" renames
4970 +# Commit O: olddir/{a_1, b}
4971 +# Commit A: newdir/{a_2, b}
4972 +# Commit B: olddir/{alpha_1, b}
4973 +# Expected: newdir/{alpha_2, b}
4974 +
4975 +test_setup_12h () {
4976 + test_create_repo 12h &&
4977 + (
4978 + cd 12h &&
4979 +
4980 + mkdir olddir &&
4981 + test_seq 3 8 >olddir/a &&
4982 + >olddir/b &&
4983 + git add olddir &&
4984 + git commit -m orig &&
4985 +
4986 + git branch O &&
4987 + git branch A &&
4988 + git branch B &&
4989 +
4990 + git switch A &&
4991 + test_seq 3 10 >olddir/a &&
4992 + git add olddir/a &&
4993 + git mv olddir newdir &&
4994 + git commit -m A &&
4995 +
4996 + git switch B &&
4997 +
4998 + git mv olddir/a olddir/alpha &&
4999 + git commit -m B
5000 + )
5001 +}
5002 +
5003 +test_expect_failure '12h: renaming a file within a renamed directory' '
5004 + test_setup_12h &&
5005 + (
5006 + cd 12h &&
5007 +
5008 + git checkout A^0 &&
5009 +
5010 + test_might_fail git -c merge.directoryRenames=true merge -s recursive B^0 &&
5011 +
5012 + git ls-files >tracked &&
5013 + test_line_count = 2 tracked &&
5014 +
5015 + test_path_is_missing olddir/a &&
5016 + test_path_is_file newdir/alpha &&
5017 + test_path_is_file newdir/b &&
5018 +
5019 + git rev-parse >actual \
5020 + HEAD:newdir/alpha HEAD:newdir/b &&
5021 + git rev-parse >expect \
5022 + A:newdir/a O:oldir/b &&
5023 + test_cmp expect actual
5024 + )
5025 +'
5026 +
5027 ###########################################################################
5028 # SECTION 13: Checking informational and conflict messages
5029 #