Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2018-06-10 07:16:16 +0300
committerJunio C Hamano <gitster@pobox.com>2018-06-12 20:22:57 +0300
commit5b26c3c941d3c7cd96be668e1778ba22cc4829d5 (patch)
treeedb65b450540c073dd69e1c33d9cedaf1f576921 /merge-recursive.c
parent8ebe7b057ad866e027365526782cd2e42a0bd106 (diff)
merge-recursive: add pointer about unduly complex looking code
handle_change_delete() has a block of code displaying one of four nearly identical messages. Each contains about half a dozen variable interpolations, which use nearly identical variables as well. Someone trying to parse this may be slowed down trying to parse the differences and why they are here; help them out by adding a comment explaining the differences. Further, point out that this code structure isn't collapsed into something more concise and readable for the programmer, because we want to keep full messages intact in order to make translators' jobs much easier. 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.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index 7cf11dc04c..284b27d895 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1476,6 +1476,21 @@ static int handle_change_delete(struct merge_options *o,
if (!ret)
ret = update_file(o, 0, o_oid, o_mode, update_path);
} else {
+ /*
+ * Despite the four nearly duplicate messages and argument
+ * lists below and the ugliness of the nested if-statements,
+ * having complete messages makes the job easier for
+ * translators.
+ *
+ * The slight variance among the cases is due to the fact
+ * that:
+ * 1) directory/file conflicts (in effect if
+ * !alt_path) could cause us to need to write the
+ * file to a different path.
+ * 2) renames (in effect if !old_path) could mean that
+ * there are two names for the path that the user
+ * may know the file by.
+ */
if (!alt_path) {
if (!old_path) {
output(o, 1, _("CONFLICT (%s/delete): %s deleted in %s "