Skip to content

Commit 3b130ad

Browse files
newrengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 161cf7f commit 3b130ad

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

merge-recursive.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,8 +1004,20 @@ static int process_renames(struct merge_options *o,
10041004
try_merge = 0;
10051005

10061006
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+
}
10091021
} else if ((dst_other.mode == ren1->pair->two->mode) &&
10101022
sha_eq(dst_other.sha1, ren1->pair->two->sha1)) {
10111023
/* Added file on the other side
@@ -1346,6 +1358,12 @@ static int process_df_entry(struct merge_options *o,
13461358
struct rename_df_conflict_info *conflict_info = entry->rename_df_conflict_info;
13471359
char *src;
13481360
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;
13491367
case RENAME_ONE_FILE_TO_TWO:
13501368
src = conflict_info->pair1->one->path;
13511369
clean_merge = 0;

0 commit comments

Comments
 (0)