@matheusbsbs / matheus-bagliano / commits / 3b130adf9c
Fork 0

merge-recursive: Delay handling of rename/delete conflicts

Move the handling of rename/delete conflicts from process_renames() to process_df_entry(). 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 3b130adf9c8b0b37acb0959b84a3222bc22ebcff
1 file changed +20 -2
merge-recursive.c
+20 -2
@@ -1004,8 +1004,20 @@ static int process_renames(struct merge_options *o,
1004 try_merge = 0;
1005
1006 if (sha_eq(src_other.sha1, null_sha1)) {
1007 - clean_merge = 0;
1008 - conflict_rename_delete(o, ren1->pair, branch1, branch2);
1007 + if (string_list_has_string(&o->current_directory_set, ren1_dst)) {
1008 + ren1->dst_entry->processed = 0;
1009 + setup_rename_df_conflict_info(RENAME_DELETE,
1010 + ren1->pair,
1011 + NULL,
1012 + branch1,
1013 + branch2,
1014 + ren1->dst_entry,
1015 + NULL);
1016 + remove_file(o, 0, ren1_dst, 0);
1017 + } else {
1018 + clean_merge = 0;
1019 + conflict_rename_delete(o, ren1->pair, branch1, branch2);
1020 + }
1021 } else if ((dst_other.mode == ren1->pair->two->mode) &&
1022 sha_eq(dst_other.sha1, ren1->pair->two->sha1)) {
1023 /* Added file on the other side
@@ -1346,6 +1358,12 @@ static int process_df_entry(struct merge_options *o,
1358 struct rename_df_conflict_info *conflict_info = entry->rename_df_conflict_info;
1359 char *src;
1360 switch (conflict_info->rename_type) {
1361 + case RENAME_DELETE:
1362 + clean_merge = 0;
1363 + conflict_rename_delete(o, conflict_info->pair1,
1364 + conflict_info->branch1,
1365 + conflict_info->branch2);
1366 + break;
1367 case RENAME_ONE_FILE_TO_TWO:
1368 src = conflict_info->pair1->one->path;
1369 clean_merge = 0;