Skip to content

Commit 71f7ffc

Browse files
newrengitster
authored andcommitted
merge-recursive: Delay modify/delete conflicts if D/F conflict present
When handling merges with modify/delete conflicts, if the modified path is involved in a D/F conflict, handle the issue in process_df_entry() rather than process_entry(). Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 882fd11 commit 71f7ffc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

merge-recursive.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,10 @@ static int process_entry(struct merge_options *o,
12491249
output(o, 2, "Removing %s", path);
12501250
/* do not touch working file if it did not exist */
12511251
remove_file(o, 1, path, !a_sha);
1252+
} else if (string_list_has_string(&o->current_directory_set,
1253+
path)) {
1254+
entry->processed = 0;
1255+
return 1; /* Assume clean till processed */
12521256
} else {
12531257
/* Deleted in one and changed in the other */
12541258
clean_merge = 0;
@@ -1367,6 +1371,11 @@ static int process_df_entry(struct merge_options *o,
13671371
entry->processed = 0;
13681372
break;
13691373
}
1374+
} else if (o_sha && (!a_sha || !b_sha)) {
1375+
/* Modify/delete; deleted side may have put a directory in the way */
1376+
clean_merge = 0;
1377+
handle_delete_modify(o, path,
1378+
a_sha, a_mode, b_sha, b_mode);
13701379
} else if (!o_sha && !!a_sha != !!b_sha) {
13711380
/* directory -> (directory, file) */
13721381
const char *add_branch;

0 commit comments

Comments
 (0)