merge-recursive: avoid spurious rename/rename conflict from dir renames
If a file on one side of history was renamed, and merely modified on the
other side, then applying a directory rename to the modified side gives us
a rename/rename(1to2) conflict. We should only apply directory renames to
pairs representing either adds or renames.
Making this change means that a directory rename testcase that was
previously reported as a rename/delete conflict will now be reported as a
modify/delete conflict.
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Elijah Newren7 years agocommitted byJunio C Hamano
@ -2078,18 +2078,23 @@ test_expect_success '8b-check: Dual-directory rename, one into the others way, w
@@ -2078,18 +2078,23 @@ test_expect_success '8b-check: Dual-directory rename, one into the others way, w
)
'
# Testcase 8c, rename+modify/delete
# (Related to testcases 5b and 8d)
# Testcase 8c, modify/delete or rename+modify/delete?
# (Related to testcases 5b, 8d, and 9h)
# Commit O: z/{b,c,d}
# Commit A: y/{b,c}
# Commit B: z/{b,c,d_modified,e}
# Expected: y/{b,c,e}, CONFLICT(rename+modify/delete: x/d -> y/d or deleted)
# Expected: y/{b,c,e}, CONFLICT(modify/delete: on z/d)
#
# Note: This testcase doesn't present any concerns for me...until you
# compare it with testcases 5b and 8d. See notes in 8d for more
# Note: It would also be somewhat reasonable to resolve this as
# y/{b,c,e}, CONFLICT(rename/delete: x/d -> y/d or deleted)
# The logic being that the only difference between this testcase and 8c
# is that there is no modification to d. That suggests that instead of a
# rename/modify vs. delete conflict, we should just have a rename/delete
# conflict, otherwise we are being inconsistent.
#
# However...as far as consistency goes, we didn't report a conflict for
# path d_1 in testcase 5b due to a different file being in the way. So,
# we seem to be forced to have cases where users can change things
# slightly and get what they may perceive as inconsistent results. It
# would be nice to avoid that, but I'm not sure I see how.
#
# In this case, I'm leaning towards: commit A was the one that deleted z/d
# and it did the rename of z to y, so the two "conflicts" (rename vs.
@ -2915,7 +2910,7 @@ test_expect_success '9h-setup: Avoid dir rename on merely modified path' '
@@ -2915,7 +2910,7 @@ test_expect_success '9h-setup: Avoid dir rename on merely modified path' '
)
'
test_expect_failure '9h-check: Avoid dir rename on merely modified path' '
test_expect_success '9h-check: Avoid dir rename on merely modified path' '
(
cd 9h &&
@ -3959,7 +3954,7 @@ test_expect_success '12c-setup: Moving one directory hierarchy into another w/ c
@@ -3959,7 +3954,7 @@ test_expect_success '12c-setup: Moving one directory hierarchy into another w/ c
)
'
test_expect_failure '12c-check: Moving one directory hierarchy into another w/ content merge' '
test_expect_success '12c-check: Moving one directory hierarchy into another w/ content merge' '