@matheusbsbs / matheus-bagliano / commits / 4c0c1810c9
Fork 0

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 <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Sep 20, 2010 at 02:29 UTC 4c0c1810c98e20ce05b2f026d6f9d62cfef7aefc
1 file changed +2 -15
merge-recursive.c
+2 -15
@@ -1032,8 +1032,6 @@ static int process_renames(struct merge_options *o,
1032 branch2,
1033 ren1->dst_entry,
1034 ren2->dst_entry);
1035 - remove_file(o, 0, ren1_dst, 0);
1036 - /* ren2_dst not in head, so no need to delete */
1035 } else {
1036 remove_file(o, 1, ren1_src, 1);
1037 update_stages_and_entry(ren1_dst,
@@ -1077,7 +1075,6 @@ static int process_renames(struct merge_options *o,
1075 branch2,
1076 ren1->dst_entry,
1077 NULL);
1080 - remove_file(o, 0, ren1_dst, 0);
1078 } else {
1079 clean_merge = 0;
1080 conflict_rename_delete(o, ren1->pair, branch1, branch2);
@@ -1156,7 +1153,6 @@ static int process_renames(struct merge_options *o,
1153 NULL,
1154 ren1->dst_entry,
1155 NULL);
1159 - remove_file(o, 0, ren1_dst, 0);
1156 }
1157 }
1158 }
@@ -1338,7 +1334,7 @@ static int process_entry(struct merge_options *o,
1334 } else if (string_list_has_string(&o->current_directory_set,
1335 path)) {
1336 entry->processed = 0;
1341 - return 1; /* Assume clean till processed */
1337 + return 1; /* Assume clean until processed */
1338 } else {
1339 /* Deleted in one and changed in the other */
1340 clean_merge = 0;
@@ -1362,15 +1358,7 @@ static int process_entry(struct merge_options *o,
1358 if (string_list_has_string(&o->current_directory_set, path)) {
1359 /* Handle D->F conflicts after all subfiles */
1360 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 */
1362 } else {
1363 output(o, 2, "Adding %s", path);
1364 update_file(o, 1, sha, mode, path);
@@ -1492,7 +1480,6 @@ static int process_df_entry(struct merge_options *o,
1480 output(o, 1, "CONFLICT (%s): There is a directory with name %s in %s. "
1481 "Adding %s as %s",
1482 conf, path, other_branch, path, new_path);
1495 - remove_file(o, 0, path, 0);
1483 update_file(o, 0, sha, mode, new_path);
1484 } else {
1485 output(o, 2, "Adding %s", path);