list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <>
To: Josh Soref via GitGitGadget <>
Cc: Git List <>, Josh Soref <>
Subject: Re: [PATCH v2] git-merge: move primary point before parenthetical
Date: Wed, 21 Apr 2021 19:46:14 -0400	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Wed, Apr 21, 2021 at 7:22 PM Josh Soref via GitGitGadget
<> wrote:
> Usually, it is easier to read a message if it makes its primary
> point first, before giving a parenthetical note.
> Before:
> ` (nothing to squash)Already up to date.
> `
> After:
> `Already up to date (nothing to squash).
> `

Thanks. This makes perfect sense and fixes what clearly seems to be a
case of swapped arguments to printf(). While the intent of the patch
is quite desirable, I do have some concerns about the actual

> Signed-off-by: Josh Soref <>
> ---
> diff --git a/builtin/merge.c b/builtin/merge.c
> @@ -383,7 +383,7 @@ static void restore_state(const struct object_id *head,
>  static void finish_up_to_date(const char *msg)
>  {
>         if (verbosity >= 0)
> -               printf("%s%s\n", squash ? _(" (nothing to squash)") : "", msg);
> +               printf(msg, squash ? _(" (nothing to squash)") : "");
>         remove_merge_branch_state(the_repository);
>  }
> @@ -1482,7 +1482,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
> -               finish_up_to_date(_("Already up to date."));
> +               finish_up_to_date(_("Already up to date%s.\n"));
> @@ -1566,7 +1566,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
> -                       finish_up_to_date(_("Already up to date. Yeeah!"));
> +                       finish_up_to_date(_("Already up to date%s. Yeeah!\n"));

I see why you changed the calling convention, making it the
responsibility of the caller to supply the "%s" so that the "(nothing
to squash)" annotation gets inserted before the period at the end of
"Already up to date". However, this makes things confusing for people
translating the text to other languages since they won't have enough
context to understand what gets interpolated in place of "%s".

In fact (not a fault of your patch), this sort of "sentence Lego" was
already a bit difficult on translators because they couldn't see the
entire context of "Already up to date" and "(nothing to squash)"
together, thus could only translate them individually which may have
led to inferior translations in some languages.

Ideally, for the sake of translators, we want to give them as much
context as possible, such as the entire "Already up to date (nothing
to squash)". So, keeping translators and context in mind, and asking
if we really need to that rather odd "Yeeah!", an alternative way to
resolve this problem would be like this:

    static void finish_up_to_date()
        if (verbosity >= 0) {
            if (squash)
                puts(_("Already up to date (nothing to squash)."));
                puts(_("Already up to date."));

And then the callers reduce simply to:


  reply	other threads:[~2021-04-21 23:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-18 18:33 [PATCH] git-merge: move space to between strings Josh Soref via GitGitGadget
2021-04-18 19:17 ` Junio C Hamano
2021-04-21 23:22 ` [PATCH v2] git-merge: move primary point before parenthetical Josh Soref via GitGitGadget
2021-04-21 23:46   ` Eric Sunshine [this message]
2021-04-22  0:55   ` [PATCH v3] git-merge: rewrite already up to date message Josh Soref via GitGitGadget
2021-04-22  3:41     ` Eric Sunshine
2021-04-28  4:04     ` Junio C Hamano
2021-04-29  7:52       ` Junio C Hamano
2021-05-02  1:51         ` Josh Soref
2021-05-02  2:15           ` Eric Sunshine
2021-05-02  2:39             ` Junio C Hamano
2021-05-02  6:26             ` Junio C Hamano
2021-05-02  7:14               ` Eric Sunshine
2021-05-02  5:14     ` [PATCH v4 0/2] normalize & fix merge "up to date" messages Eric Sunshine
2021-05-02  5:14       ` [PATCH v4 1/2] merge(s): apply consistent punctuation to " Eric Sunshine
2021-05-02  5:14       ` [PATCH v4 2/2] merge: fix swapped "up to date" message components Eric Sunshine
2021-05-03  5:21         ` Junio C Hamano
2021-05-03  5:50           ` Eric Sunshine
2021-05-03  6:28             ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='' \ \ \ \ \
    --subject='Re: [PATCH v2] git-merge: move primary point before parenthetical' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ \
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
 note: .onion URLs require Tor:

code repositories for project(s) associated with this inbox:

AGPL code for this site: git clone