From 80cde95eecbc3e0812a92eaa7bcd534dd256ceab Mon Sep 17 00:00:00 2001 From: Eric Sunshine Date: Sun, 2 May 2021 01:14:22 -0400 Subject: [PATCH 1/2] merge(s): apply consistent punctuation to "up to date" messages Although the various "Already up to date" messages resulting from merge attempts share identical phrasing, they use a mix of punctuation ranging from "." to "!" and even "Yeeah!", which leads to extra work for translators. Ease the job of translators by settling upon "." as punctuation for all such messages. While at it, take advantage of printf_ln() to further ease the translation task so translators need not worry about line termination, and fix a case of missing line termination in the (unused) merge_ort_nonrecursive() function. Suggested-by: Junio C Hamano Signed-off-by: Eric Sunshine Signed-off-by: Junio C Hamano --- builtin/merge.c | 2 +- merge-ort-wrappers.c | 2 +- merge-recursive.c | 2 +- notes-merge.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/builtin/merge.c b/builtin/merge.c index 388619536a..3472a0ce3b 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -1610,7 +1610,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix) } } if (up_to_date) { - finish_up_to_date(_("Already up to date. Yeeah!")); + finish_up_to_date(_("Already up to date.")); goto done; } } diff --git a/merge-ort-wrappers.c b/merge-ort-wrappers.c index 7eec25f93a..ad04106169 100644 --- a/merge-ort-wrappers.c +++ b/merge-ort-wrappers.c @@ -30,7 +30,7 @@ int merge_ort_nonrecursive(struct merge_options *opt, return -1; if (oideq(&merge_base->object.oid, &merge->object.oid)) { - printf(_("Already up to date!")); + printf_ln(_("Already up to date.")); return 1; } diff --git a/merge-recursive.c b/merge-recursive.c index b69e694d98..7e99431d66 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -3432,7 +3432,7 @@ static int merge_trees_internal(struct merge_options *opt, } if (oideq(&merge_base->object.oid, &merge->object.oid)) { - output(opt, 0, _("Already up to date!")); + output(opt, 0, _("Already up to date.")); *result = head; return 1; } diff --git a/notes-merge.c b/notes-merge.c index d2771fa3d4..321155fc87 100644 --- a/notes-merge.c +++ b/notes-merge.c @@ -628,7 +628,7 @@ int notes_merge(struct notes_merge_options *o, if (oideq(&remote->object.oid, base_oid)) { /* Already merged; result == local commit */ if (o->verbosity >= 2) - printf("Already up to date!\n"); + printf_ln("Already up to date."); oidcpy(result_oid, &local->object.oid); goto found_result; } From ad9322da033fac2678cab90988321549e0f1c86f Mon Sep 17 00:00:00 2001 From: Josh Soref Date: Sun, 2 May 2021 01:14:23 -0400 Subject: [PATCH 2/2] merge: fix swapped "up to date" message components The rewrite of git-merge from shell to C in 1c7b76be7d (Build in merge, 2008-07-07) accidentally transformed the message: Already up-to-date. (nothing to squash) to: (nothing to squash)Already up-to-date. due to reversed printf() arguments. This problem has gone unnoticed despite being touched over the years by 7f87aff22c (Teach/Fix pull/fetch -q/-v options, 2008-11-15) and bacec47845 (i18n: git-merge basic messages, 2011-02-22), and tangentially by bef4830e88 (i18n: merge: mark messages for translation, 2016-06-17) and 7560f547e6 (treewide: correct several "up-to-date" to "up to date", 2017-08-23). Fix it by restoring the message to its intended order. While at it, help translators out by avoiding "sentence Lego". [es: rewrote commit message] Co-authored-by: Eric Sunshine Signed-off-by: Josh Soref Signed-off-by: Eric Sunshine Signed-off-by: Junio C Hamano --- builtin/merge.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/builtin/merge.c b/builtin/merge.c index 3472a0ce3b..eddb8ae70d 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -393,10 +393,14 @@ static void restore_state(const struct object_id *head, } /* This is called when no merge was necessary. */ -static void finish_up_to_date(const char *msg) +static void finish_up_to_date(void) { - if (verbosity >= 0) - printf("%s%s\n", squash ? _(" (nothing to squash)") : "", msg); + if (verbosity >= 0) { + if (squash) + puts(_("Already up to date. (nothing to squash)")); + else + puts(_("Already up to date.")); + } remove_merge_branch_state(the_repository); } @@ -1522,7 +1526,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix) * If head can reach all the merge then we are up to date. * but first the most common case of merging one remote. */ - finish_up_to_date(_("Already up to date.")); + finish_up_to_date(); goto done; } else if (fast_forward != FF_NO && !remoteheads->next && !common->next && @@ -1610,7 +1614,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix) } } if (up_to_date) { - finish_up_to_date(_("Already up to date.")); + finish_up_to_date(); goto done; } }