Skip to content

Commit 161cf7f

Browse files
newrengitster
authored andcommitted
merge-recursive: Move handling of double rename of one file to other file
Move the handling of rename/rename conflicts where one file is renamed on both sides to the same file, from process_renames() to process_entry(). Here we avoid the three way merge logic by just using update_stages_and_entry() to move the higher stage entries in the index from the rename source to the rename destination, and then allow process_entry() to do its magic. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 07413c5 commit 161cf7f

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

merge-recursive.c

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -971,33 +971,13 @@ static int process_renames(struct merge_options *o,
971971
remove_file(o, 0, ren1_dst, 0);
972972
/* ren2_dst not in head, so no need to delete */
973973
} else {
974-
struct merge_file_info mfi;
975974
remove_file(o, 1, ren1_src, 1);
976-
mfi = merge_file(o,
977-
ren1->pair->one,
978-
ren1->pair->two,
979-
ren2->pair->two,
980-
branch1,
981-
branch2);
982-
if (mfi.merge || !mfi.clean)
983-
output(o, 1, "Renaming %s->%s", src, ren1_dst);
984-
985-
if (mfi.merge)
986-
output(o, 2, "Auto-merging %s", ren1_dst);
987-
988-
if (!mfi.clean) {
989-
output(o, 1, "CONFLICT (content): merge conflict in %s",
990-
ren1_dst);
991-
clean_merge = 0;
992-
993-
if (!o->call_depth)
994-
update_stages(ren1_dst,
995-
ren1->pair->one,
996-
ren1->pair->two,
997-
ren2->pair->two,
998-
1 /* clear */);
999-
}
1000-
update_file(o, mfi.clean, mfi.sha, mfi.mode, ren1_dst);
975+
update_stages_and_entry(ren1_dst,
976+
ren1->dst_entry,
977+
ren1->pair->one,
978+
ren1->pair->two,
979+
ren2->pair->two,
980+
1 /* clear */);
1001981
}
1002982
} else {
1003983
/* Renamed in 1, maybe changed in 2 */

0 commit comments

Comments
 (0)