summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2010-09-20 02:28:48 -0600
committerJunio C Hamano <gitster@pobox.com>2010-09-29 17:32:37 -0700
commit09c01f856f65ffdde9a61708a5d74a372d68807a (patch)
tree3b69a7e007f003be05aad5ed905ae16b55c35639 /merge-recursive.c
parent41d70bd6a94d1bd1ec09d2a3d6ebd419abb25bca (diff)
downloadgit-09c01f856f65ffdde9a61708a5d74a372d68807a.tar.gz
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>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index f9531c8069..771564f7f4 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -730,12 +730,13 @@ static struct merge_file_info merge_file(struct merge_options *o,
return result;
}
-static void conflict_rename_rename(struct merge_options *o,
- struct rename *ren1,
- const char *branch1,
- struct rename *ren2,
- const char *branch2)
+static void conflict_rename_rename_1to2(struct merge_options *o,
+ struct rename *ren1,
+ const char *branch1,
+ struct rename *ren2,
+ const char *branch2)
{
+ /* One file was renamed in both branches, but to different names. */
char *del[2];
int delp = 0;
const char *ren1_dst = ren1->pair->two->path;
@@ -782,12 +783,13 @@ static void conflict_rename_dir(struct merge_options *o,
free(new_path);
}
-static void conflict_rename_rename_2(struct merge_options *o,
- struct rename *ren1,
- const char *branch1,
- struct rename *ren2,
- const char *branch2)
+static void conflict_rename_rename_2to1(struct merge_options *o,
+ struct rename *ren1,
+ const char *branch1,
+ struct rename *ren2,
+ const char *branch2)
{
+ /* Two files were renamed to the same thing. */
char *new_path1 = unique_path(o, ren1->pair->two->path, branch1);
char *new_path2 = unique_path(o, ren2->pair->two->path, branch2);
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,
ren1->pair->one->mode, src);
}
- conflict_rename_rename(o, ren1, branch1, ren2, branch2);
+ conflict_rename_rename_1to2(o, ren1, branch1, ren2, branch2);
} else {
struct merge_file_info mfi;
remove_file(o, 1, ren1_src, 1);
@@ -1004,7 +1006,7 @@ static int process_renames(struct merge_options *o,
"Rename %s->%s in %s",
ren1_src, ren1_dst, branch1,
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
try_merge = 1;