[PATCH 15/37] merge-recursive: Rename conflict_rename_rename*() for clarity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 merge-recursive.c |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/merge-recursive.c b/merge-recursive.c
index 8f45cec..cc1ab92 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -731,12 +731,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;
@@ -783,12 +784,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",
@@ -890,7 +892,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);
@@ -1005,7 +1007,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;
 
-- 
1.7.3.271.g16009

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]