merge-recursive: Rename conflict_rename_rename*() for clarity

The names conflict_rename_rename and conflict_rename_rename_2 did not make
it clear what they were handling.  Since the first of these handles one
file being renamed in both branches to different files, while the latter
handles two different files being renamed to the same thing, add a little
'1to2' and '2to1' suffix on these and an explanatory comment to make their
intent clearer.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Elijah Newren 2010-09-20 02:28:48 -06:00 committed by Junio C Hamano
parent 41d70bd6a9
commit 09c01f856f

View File

@ -730,12 +730,13 @@ static struct merge_file_info merge_file(struct merge_options *o,
return result; return result;
} }
static void conflict_rename_rename(struct merge_options *o, static void conflict_rename_rename_1to2(struct merge_options *o,
struct rename *ren1, struct rename *ren1,
const char *branch1, const char *branch1,
struct rename *ren2, struct rename *ren2,
const char *branch2) const char *branch2)
{ {
/* One file was renamed in both branches, but to different names. */
char *del[2]; char *del[2];
int delp = 0; int delp = 0;
const char *ren1_dst = ren1->pair->two->path; const char *ren1_dst = ren1->pair->two->path;
@ -782,12 +783,13 @@ static void conflict_rename_dir(struct merge_options *o,
free(new_path); free(new_path);
} }
static void conflict_rename_rename_2(struct merge_options *o, static void conflict_rename_rename_2to1(struct merge_options *o,
struct rename *ren1, struct rename *ren1,
const char *branch1, const char *branch1,
struct rename *ren2, struct rename *ren2,
const char *branch2) const char *branch2)
{ {
/* Two files were renamed to the same thing. */
char *new_path1 = unique_path(o, ren1->pair->two->path, branch1); char *new_path1 = unique_path(o, ren1->pair->two->path, branch1);
char *new_path2 = unique_path(o, ren2->pair->two->path, branch2); char *new_path2 = unique_path(o, ren2->pair->two->path, branch2);
output(o, 1, "Renaming %s to %s and %s to %s instead", output(o, 1, "Renaming %s to %s and %s to %s instead",
@ -889,7 +891,7 @@ static int process_renames(struct merge_options *o,
update_file(o, 0, ren1->pair->one->sha1, update_file(o, 0, ren1->pair->one->sha1,
ren1->pair->one->mode, src); ren1->pair->one->mode, src);
} }
conflict_rename_rename(o, ren1, branch1, ren2, branch2); conflict_rename_rename_1to2(o, ren1, branch1, ren2, branch2);
} else { } else {
struct merge_file_info mfi; struct merge_file_info mfi;
remove_file(o, 1, ren1_src, 1); remove_file(o, 1, ren1_src, 1);
@ -1004,7 +1006,7 @@ static int process_renames(struct merge_options *o,
"Rename %s->%s in %s", "Rename %s->%s in %s",
ren1_src, ren1_dst, branch1, ren1_src, ren1_dst, branch1,
ren2->pair->one->path, ren2->pair->two->path, branch2); ren2->pair->one->path, ren2->pair->two->path, branch2);
conflict_rename_rename_2(o, ren1, branch1, ren2, branch2); conflict_rename_rename_2to1(o, ren1, branch1, ren2, branch2);
} else } else
try_merge = 1; try_merge = 1;