git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] am: fix error message in parse_opt_show_current_patch()

From
Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Date
Sep 21, 2023, 19:28 UTC
Message-ID
<ZQyZcs/zXnPqc0Zd@ugly>
In-Reply-To
<xmqqh6nn5oo9.fsf@gitster.g>
On Thu, Sep 21, 2023 at 12:09:10PM -0700, Junio C Hamano wrote:
Show 9 quoted lines
>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
Previous: Junio C HamanoNext: Phillip Wood
Message 12 of 36 in “parse-options: add int value pointer to struct option”
  1. 1/2 parse-options: add int value pointer to struct optionRené Scharfe, Sep 9, 2023
  2. 2/2 parse-options: use and require int pointer for OPT_CMDMODERené Scharfe, Sep 9, 2023
  3. Oswald BuddenhagenSep 10, 2023
  4. René ScharfeSep 11, 2023
  5. Jeff KingSep 12, 2023
  6. Junio C HamanoSep 16, 2023
  7. René ScharfeSep 18, 2023
  8. Oswald BuddenhagenSep 18, 2023
  9. René ScharfeSep 19, 2023
  10. am: fix error message in parse_opt_show_current_patch()Oswald Buddenhagen, Sep 21, 2023
  11. Junio C HamanoSep 21, 2023
  12. Oswald BuddenhagenSep 21, 2023
  13. Phillip WoodSep 18, 2023
  14. Junio C HamanoSep 18, 2023
  15. Phillip WoodSep 18, 2023
  16. René ScharfeOct 3, 2023
  17. Junio C HamanoOct 3, 2023
  18. René ScharfeSep 19, 2023
  19. Junio C HamanoSep 11, 2023
  20. René ScharfeSep 11, 2023
  21. Oswald BuddenhagenSep 19, 2023
  22. René ScharfeSep 20, 2023
  23. Oswald BuddenhagenSep 21, 2023
  24. René ScharfeOct 3, 2023
  25. Oswald BuddenhagenOct 3, 2023
  26. René ScharfeOct 3, 2023
  27. Oswald BuddenhagenOct 3, 2023
  28. Taylor BlauSep 10, 2023
  29. René ScharfeSep 11, 2023
  30. Junio C HamanoSep 11, 2023
  31. Oswald BuddenhagenSep 11, 2023
  32. Kristoffer HaugsbakkSep 18, 2023
  33. René ScharfeSep 18, 2023
  34. Oswald BuddenhagenSep 18, 2023
  35. Junio C HamanoSep 18, 2023
  36. René ScharfeSep 20, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.