Skip to content

Commit 4c0c181

Browse files
newrengitster
authored andcommitted
merge-recursive: Remove redundant path clearing for D/F conflicts
The code had several places where individual checks were done to remove files that could be in the way of directories in D/F conflicts. Not all D/F conflicts could have a path cleared for them in such a manner, however, leading to the need to create make_room_for_directories_of_df_conflicts() as done in the previous patch. That new function could not have been incorporated into the code sooner, since not all relevant code paths had been deferred to process_df_entry() yet, leading to the creation of even more of these now-redundant path removals. Clean out all of these extra D/F path clearing cases. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ef02b31 commit 4c0c181

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

merge-recursive.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,8 +1032,6 @@ static int process_renames(struct merge_options *o,
10321032
branch2,
10331033
ren1->dst_entry,
10341034
ren2->dst_entry);
1035-
remove_file(o, 0, ren1_dst, 0);
1036-
/* ren2_dst not in head, so no need to delete */
10371035
} else {
10381036
remove_file(o, 1, ren1_src, 1);
10391037
update_stages_and_entry(ren1_dst,
@@ -1077,7 +1075,6 @@ static int process_renames(struct merge_options *o,
10771075
branch2,
10781076
ren1->dst_entry,
10791077
NULL);
1080-
remove_file(o, 0, ren1_dst, 0);
10811078
} else {
10821079
clean_merge = 0;
10831080
conflict_rename_delete(o, ren1->pair, branch1, branch2);
@@ -1156,7 +1153,6 @@ static int process_renames(struct merge_options *o,
11561153
NULL,
11571154
ren1->dst_entry,
11581155
NULL);
1159-
remove_file(o, 0, ren1_dst, 0);
11601156
}
11611157
}
11621158
}
@@ -1338,7 +1334,7 @@ static int process_entry(struct merge_options *o,
13381334
} else if (string_list_has_string(&o->current_directory_set,
13391335
path)) {
13401336
entry->processed = 0;
1341-
return 1; /* Assume clean till processed */
1337+
return 1; /* Assume clean until processed */
13421338
} else {
13431339
/* Deleted in one and changed in the other */
13441340
clean_merge = 0;
@@ -1362,15 +1358,7 @@ static int process_entry(struct merge_options *o,
13621358
if (string_list_has_string(&o->current_directory_set, path)) {
13631359
/* Handle D->F conflicts after all subfiles */
13641360
entry->processed = 0;
1365-
/* But get any file out of the way now, so conflicted
1366-
* entries below the directory of the same name can
1367-
* be put in the working directory.
1368-
*/
1369-
if (a_sha)
1370-
output(o, 2, "Removing %s", path);
1371-
/* do not touch working file if it did not exist */
1372-
remove_file(o, 0, path, !a_sha);
1373-
return 1; /* Assume clean till processed */
1361+
return 1; /* Assume clean until processed */
13741362
} else {
13751363
output(o, 2, "Adding %s", path);
13761364
update_file(o, 1, sha, mode, path);
@@ -1492,7 +1480,6 @@ static int process_df_entry(struct merge_options *o,
14921480
output(o, 1, "CONFLICT (%s): There is a directory with name %s in %s. "
14931481
"Adding %s as %s",
14941482
conf, path, other_branch, path, new_path);
1495-
remove_file(o, 0, path, 0);
14961483
update_file(o, 0, sha, mode, new_path);
14971484
} else {
14981485
output(o, 2, "Adding %s", path);

0 commit comments

Comments
 (0)