Skip to content

Commit 15f3e1e

Browse files
newrengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f3b964a commit 15f3e1e

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

t/t6423-merge-rename-directories.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4966,6 +4966,64 @@ test_expect_success '12g: Testcase with two kinds of "relevant" renames' '
49664966
)
49674967
'
49684968

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+
49695027
###########################################################################
49705028
# SECTION 13: Checking informational and conflict messages
49715029
#

0 commit comments

Comments
 (0)