git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Jean-Noël Avila" <jn.avila@free.fr>,
	"Johannes Sixt" <j6t@kdbg.org>, "René Scharfe" <l.s.r@web.de>
Subject: Re: [PATCH] am: fix error message in parse_opt_show_current_patch()
Date: Thu, 21 Sep 2023 21:28:50 +0200	[thread overview]
Message-ID: <ZQyZcs/zXnPqc0Zd@ugly> (raw)
In-Reply-To: <xmqqh6nn5oo9.fsf@gitster.g>

On Thu, Sep 21, 2023 at 12:09:10PM -0700, Junio C Hamano wrote:
>Oswald Buddenhagen <oswald.buddenhagen@gmx.de> writes:
>> fwiw, this is currently the only message that actually uses the %s=%s
>> format, so as of now, factoring out the argument names has only
>> theoretical value.
>
>I am not sure I follow, if you mean that the programmer needs to
>pass "--show-current-patch" only once if we used something like
>"%1$s=%2s and %1$s=%3s", I agree that it probably has little value.
>
no, i mean that that the usual pattern is just "options '%s' and '%s' 
cannot be used together". this format string is indeed used many times, 
so it makes sense to factor out the option names to avoid duplication of 
translatable strings. not so here. but this particular case is still a 
lot less specialized than many of the other strings replaced by the 
referenced patch, and it's at least plausible that further uses would be 
added at some point, so i left it as-is.

i thought about the duplication of the option string as well, but 
compilers should merge the string constants, so that part is indeed 
de-duplicated. the cost of the extra pointer push could be avoided by 
use of the %1$s syntax, but afaict that's unprecedented in git, and i 
kind of expect that some printf implementation would throw up from it.
also, it might reduce the chance of the format being used in another 
place, but who knows.

regards

  reply	other threads:[~2023-09-21 19:42 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-09 21:10 [PATCH 1/2] parse-options: add int value pointer to struct option René Scharfe
2023-09-09 21:14 ` [PATCH 2/2] parse-options: use and require int pointer for OPT_CMDMODE René Scharfe
2023-09-10 10:18   ` Oswald Buddenhagen
2023-09-11 20:11     ` René Scharfe
2023-09-12  8:40       ` Jeff King
2023-09-16 17:45         ` Junio C Hamano
2023-09-18  9:28           ` René Scharfe
2023-09-18 10:10             ` Oswald Buddenhagen
2023-09-19  7:41               ` René Scharfe
2023-09-21 11:07                 ` [PATCH] am: fix error message in parse_opt_show_current_patch() Oswald Buddenhagen
2023-09-21 19:09                   ` Junio C Hamano
2023-09-21 19:28                     ` Oswald Buddenhagen [this message]
2023-09-18 13:33             ` [PATCH 2/2] parse-options: use and require int pointer for OPT_CMDMODE Phillip Wood
2023-09-18 17:11               ` Junio C Hamano
2023-09-18 19:48                 ` Phillip Wood
2023-10-03  8:49                   ` René Scharfe
2023-10-03 17:15                     ` Junio C Hamano
2023-09-19  7:47               ` René Scharfe
2023-09-11 19:12   ` Junio C Hamano
2023-09-11 20:11     ` René Scharfe
2023-09-19  9:40   ` Oswald Buddenhagen
2023-09-20  8:18     ` René Scharfe
2023-09-21 10:40       ` Oswald Buddenhagen
2023-10-03  8:49         ` René Scharfe
2023-10-03  9:38           ` Oswald Buddenhagen
2023-10-03 17:54             ` René Scharfe
2023-10-03 18:24               ` Oswald Buddenhagen
2023-09-10 18:40 ` [PATCH 1/2] parse-options: add int value pointer to struct option Taylor Blau
2023-09-11 19:19   ` Junio C Hamano
2023-09-11 22:28     ` Oswald Buddenhagen
2023-09-18 11:34       ` Kristoffer Haugsbakk
2023-09-18  9:53     ` René Scharfe
2023-09-18 10:28       ` Oswald Buddenhagen
2023-09-18 16:17       ` Junio C Hamano
2023-09-20 11:34         ` René Scharfe
2023-09-11 20:12   ` René Scharfe

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=ZQyZcs/zXnPqc0Zd@ugly \
    --to=oswald.buddenhagen@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=jn.avila@free.fr \
    --cc=l.s.r@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).