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>
Elijah Newren committed
Sep 20, 2010 at 02:28 UTC
09c01f856f65ffdde9a61708a5d74a372d68807a
1 file changed
+14
-12
merge-recursive.c
+14
-12
@@ -730,12 +730,13 @@ static struct merge_file_info merge_file(struct merge_options *o,
730
return result;
731
}
732
733
-static void conflict_rename_rename(struct merge_options *o,
734
- struct rename *ren1,
735
- const char *branch1,
736
- struct rename *ren2,
737
- const char *branch2)
733
+static void conflict_rename_rename_1to2(struct merge_options *o,
734
+ struct rename *ren1,
735
+ const char *branch1,
736
+ struct rename *ren2,
737
+ const char *branch2)
738
{
739
+ /* One file was renamed in both branches, but to different names. */
740
char *del[2];
741
int delp = 0;
742
const char *ren1_dst = ren1->pair->two->path;
@@ -782,12 +783,13 @@ static void conflict_rename_dir(struct merge_options *o,
783
free(new_path);
784
}
785
785
-static void conflict_rename_rename_2(struct merge_options *o,
786
- struct rename *ren1,
787
- const char *branch1,
788
- struct rename *ren2,
789
- const char *branch2)
786
+static void conflict_rename_rename_2to1(struct merge_options *o,
787
+ struct rename *ren1,
788
+ const char *branch1,
789
+ struct rename *ren2,
790
+ const char *branch2)
791
{
792
+ /* Two files were renamed to the same thing. */
793
char *new_path1 = unique_path(o, ren1->pair->two->path, branch1);
794
char *new_path2 = unique_path(o, ren2->pair->two->path, branch2);
795
output(o, 1, "Renaming %s to %s and %s to %s instead",
@@ -889,7 +891,7 @@ static int process_renames(struct merge_options *o,
891
update_file(o, 0, ren1->pair->one->sha1,
892
ren1->pair->one->mode, src);
893
}
892
- conflict_rename_rename(o, ren1, branch1, ren2, branch2);
894
+ conflict_rename_rename_1to2(o, ren1, branch1, ren2, branch2);
895
} else {
896
struct merge_file_info mfi;
897
remove_file(o, 1, ren1_src, 1);
@@ -1004,7 +1006,7 @@ static int process_renames(struct merge_options *o,
1006
"Rename %s->%s in %s",
1007
ren1_src, ren1_dst, branch1,
1008
ren2->pair->one->path, ren2->pair->two->path, branch2);
1007
- conflict_rename_rename_2(o, ren1, branch1, ren2, branch2);
1009
+ conflict_rename_rename_2to1(o, ren1, branch1, ren2, branch2);
1010
} else
1011
try_merge = 1;
1012