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 <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren committed
Sep 20, 2010 at 02:29 UTC
161cf7f9490285700432f23a953f8e238f3469f5
1 file changed
+6
-26
merge-recursive.c
+6
-26
@@ -971,33 +971,13 @@ static int process_renames(struct merge_options *o,
971
remove_file(o, 0, ren1_dst, 0);
972
/* ren2_dst not in head, so no need to delete */
973
} else {
974
- struct merge_file_info mfi;
974
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 */);
981
}
982
} else {
983
/* Renamed in 1, maybe changed in 2 */