Browse Source

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>
maint
Elijah Newren 15 years ago committed by Junio C Hamano
parent
commit
4c0c1810c9
  1. 17
      merge-recursive.c

17
merge-recursive.c

@ -1032,8 +1032,6 @@ static int process_renames(struct merge_options *o,
branch2, branch2,
ren1->dst_entry, ren1->dst_entry,
ren2->dst_entry); ren2->dst_entry);
remove_file(o, 0, ren1_dst, 0);
/* ren2_dst not in head, so no need to delete */
} else { } else {
remove_file(o, 1, ren1_src, 1); remove_file(o, 1, ren1_src, 1);
update_stages_and_entry(ren1_dst, update_stages_and_entry(ren1_dst,
@ -1077,7 +1075,6 @@ static int process_renames(struct merge_options *o,
branch2, branch2,
ren1->dst_entry, ren1->dst_entry,
NULL); NULL);
remove_file(o, 0, ren1_dst, 0);
} else { } else {
clean_merge = 0; clean_merge = 0;
conflict_rename_delete(o, ren1->pair, branch1, branch2); conflict_rename_delete(o, ren1->pair, branch1, branch2);
@ -1156,7 +1153,6 @@ static int process_renames(struct merge_options *o,
NULL, NULL,
ren1->dst_entry, ren1->dst_entry,
NULL); NULL);
remove_file(o, 0, ren1_dst, 0);
} }
} }
} }
@ -1338,7 +1334,7 @@ static int process_entry(struct merge_options *o,
} else if (string_list_has_string(&o->current_directory_set, } else if (string_list_has_string(&o->current_directory_set,
path)) { path)) {
entry->processed = 0; entry->processed = 0;
return 1; /* Assume clean till processed */ return 1; /* Assume clean until processed */
} else { } else {
/* Deleted in one and changed in the other */ /* Deleted in one and changed in the other */
clean_merge = 0; clean_merge = 0;
@ -1362,15 +1358,7 @@ static int process_entry(struct merge_options *o,
if (string_list_has_string(&o->current_directory_set, path)) { if (string_list_has_string(&o->current_directory_set, path)) {
/* Handle D->F conflicts after all subfiles */ /* Handle D->F conflicts after all subfiles */
entry->processed = 0; entry->processed = 0;
/* But get any file out of the way now, so conflicted return 1; /* Assume clean until processed */
* entries below the directory of the same name can
* be put in the working directory.
*/
if (a_sha)
output(o, 2, "Removing %s", path);
/* do not touch working file if it did not exist */
remove_file(o, 0, path, !a_sha);
return 1; /* Assume clean till processed */
} else { } else {
output(o, 2, "Adding %s", path); output(o, 2, "Adding %s", path);
update_file(o, 1, sha, mode, path); update_file(o, 1, sha, mode, path);
@ -1492,7 +1480,6 @@ static int process_df_entry(struct merge_options *o,
output(o, 1, "CONFLICT (%s): There is a directory with name %s in %s. " output(o, 1, "CONFLICT (%s): There is a directory with name %s in %s. "
"Adding %s as %s", "Adding %s as %s",
conf, path, other_branch, path, new_path); conf, path, other_branch, path, new_path);
remove_file(o, 0, path, 0);
update_file(o, 0, sha, mode, new_path); update_file(o, 0, sha, mode, new_path);
} else { } else {
output(o, 2, "Adding %s", path); output(o, 2, "Adding %s", path);

Loading…
Cancel
Save