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

[RFC PATCH 0/3] usage: prefix all lines in `vreportf()`, not just the first

From
MÅMartin Ågren <martin.agren@gmail.com>
Date
May 25, 2018, 21:00 UTC
Message-ID
<cover.1527279322.git.martin.agren@gmail.com>
In-Reply-To
<xmqq8t88nllj.fsf@gitster-ct.c.googlers.com>
On 25 May 2018 at 11:14, Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>>> +                    warning("the '-l' option is an alias for '--create-reflog' and");
>>> +                    warning("has no effect in list mode. This option will soon be");
>>> +                    warning("removed and you should omit it (or use '--list' instead).");
>
> By the way, this is one of these times when I feel that we should
> have a better multi-line message support in die/error/warning/info
> functions.  Ideally, I should be able to write
[...]
>         warning(_("the '-l' option is an alias for '--create-reflog' and\n"
>                   "has no effect in list mode, This option will soon be\n"
>                   "removed and you should omit it (or use '--list' instead)."));
[...]
Show 11 quoted lines
> and warning() would:
>
>  - do the sprintf formatting thing as necessary to prepare a long multi-line
>    message;
>
>  - chomp that into lines at '\n' boundary; and
>
>  - give each of these lines with _("warning: ") prefixed.
>
> That way, translators can choose to make the resulting message to
> different number of lines from the original easily.

How about something like this? The first two patches implement the above three points, except for the translation of "warning: ".

The third patch is the main reason this is marked RFC. It translates "warning: " and similar, and breaks quite a few tests under GETTEXT_POISON since we grep for, e.g., "warning" on stderr. I could annotate those tests, but since I'm running out of time anyway, I thought I'd post this as a heads-up of "I'm looking into this".

I do wonder: If our tests rely on grepping for "warning" (for pretty good reasons), how many scripts out there do something similar (for maybe-not-so-good reasons, but still)? Do we want to avoid breaking them?

Also left to do is to convert any existing lego-ing users to the single-string form that Junio wished for above.

Martin
Martin Ågren (3):
  usage: extract `prefix_suffix_lines()` from `advise()`
  usage: prefix all lines in `vreportf()`, not just the first
  usage: translate the "error: "-prefix and others
 t/t1011-read-tree-sparse-checkout.sh |  6 ++---
 t/t1506-rev-parse-diagnosis.sh       |  2 +-
 t/t1600-index.sh                     |  6 ++---
 t/t3600-rm.sh                        | 36 ++++++++++++-------------
 t/t5512-ls-remote.sh                 |  6 ++---
 t/t7607-merge-overwrite.sh           |  6 ++---
 t/t7609-merge-co-error-msgs.sh       | 39 ++++++++++++++--------------
 git-compat-util.h                    |  8 ++++++
 advice.c                             | 18 ++++++-------
 usage.c                              | 28 ++++++++++++++++----
 10 files changed, 89 insertions(+), 66 deletions(-)
-- 
2.17.0.1181.g093e983b05
Previous: Junio C HamanoNext: Martin Ågren
Message 16 of 95 in “What's cooking in git.git (May 2018, #02; Thu, 17)”
  1. Junio C HamanoMay 17, 2018
  2. jk/branch-l-0-deprecation (was Re: What's cooking in git.git (May 2018, #02; Thu, 17))Kaartic Sivaraam, May 17, 2018
  3. Ævar Arnfjörð BjarmasonMay 17, 2018
  4. Kaartic SivaraamMay 17, 2018
  5. Ævar Arnfjörð BjarmasonMay 17, 2018
  6. Jeff KingMay 17, 2018
  7. jk/branch-l-0-deprecation (was Re: What's cooking in git.git (May 2018, #02; Thu, 17))Kaartic Sivaraam, May 24, 2018
  8. Jeff KingMay 24, 2018
  9. branch: issue "-l" deprecation warning after pager startsJeff King, May 24, 2018
  10. Junio C HamanoMay 25, 2018
  11. Jeff KingMay 25, 2018
  12. Junio C HamanoMay 25, 2018
  13. Junio C HamanoMay 25, 2018
  14. Jeff KingMay 25, 2018
  15. Junio C HamanoMay 26, 2018
  16. 0/3 usage: prefix all lines in `vreportf()`, not just the firstMartin Ågren, May 25, 2018
  17. 1/3 usage: extract `prefix_suffix_lines()` from `advise()`Martin Ågren, May 25, 2018
  18. Junio C HamanoMay 28, 2018
  19. Duy NguyenMay 28, 2018
  20. Jeff KingMay 29, 2018
  21. Jeff KingMay 29, 2018
  22. Junio C HamanoMay 30, 2018
  23. Junio C HamanoMay 30, 2018
  24. Martin ÅgrenMay 30, 2018
  25. Jeff KingMay 31, 2018
  26. 2/3 usage: prefix all lines in `vreportf()`, not just the firstMartin Ågren, May 25, 2018
  27. Junio C HamanoMay 28, 2018
  28. Duy NguyenMay 28, 2018
  29. Junio C HamanoMay 28, 2018
  30. Martin ÅgrenMay 29, 2018
  31. Junio C HamanoMay 29, 2018
  32. Martin ÅgrenMay 29, 2018
  33. Junio C HamanoMay 29, 2018
  34. Duy NguyenMay 29, 2018
  35. Martin ÅgrenMay 30, 2018
  36. Jeff KingMay 29, 2018
  37. Martin ÅgrenMay 30, 2018
  38. 3/3 usage: translate the "error: "-prefix and othersMartin Ågren, May 25, 2018
  39. Junio C HamanoMay 26, 2018
  40. Junio C HamanoMay 26, 2018
  41. Jeff KingMay 29, 2018
  42. Jeff KingMay 29, 2018
  43. Junio C HamanoMay 30, 2018
  44. Jeff KingMay 31, 2018
  45. Kaartic SivaraamMay 26, 2018
  46. Duy NguyenJun 2, 2018
  47. Jeff KingJun 2, 2018
  48. Kaartic SivaraamMay 26, 2018
  49. Jeff KingMay 29, 2018
  50. Junio C HamanoMay 30, 2018
  51. Jeff KingMay 31, 2018
  52. Junio C HamanoJun 1, 2018
  53. Kaartic.SivaraamMay 31, 2018
  54. Derrick StoleeMay 17, 2018
  55. Stefan BellerMay 17, 2018
  56. 0/2 Reroll 2 last commits of sb/object-store-replaceStefan Beller, May 17, 2018
  57. 1/2 object.c: free replace map in raw_object_store_clearStefan Beller, May 17, 2018
  58. 2/2 replace-object.c: remove the_repository from prepare_replace_objectStefan Beller, May 17, 2018
  59. merge-recursive: give notice when submodule commit gets fast-forwardedStefan Beller, May 17, 2018
  60. 0/1 rebased: inform about auto submodule ffLeif Middelschulte, May 18, 2018
  61. 0/1 rebased: inform about auto submodule ffLeif Middelschulte, May 18, 2018
  62. 1/1 Inform about fast-forwarding of submodules during mergeLeif Middelschulte, May 18, 2018
  63. Elijah NewrenMay 18, 2018
  64. Junio C HamanoMay 21, 2018
  65. 0/8 Reroll of sb/diff-color-move-moreStefan Beller, May 17, 2018
  66. 1/8 xdiff/xdiff.h: remove unused flagsStefan Beller, May 17, 2018
  67. 2/8 xdiff/xdiffi.c: remove unneeded function declarationsStefan Beller, May 17, 2018
  68. 4/8 diff.c: adjust hash function signature to match hashmap expectationStefan Beller, May 17, 2018
  69. 5/8 diff.c: add a blocks mode for moved code detectionStefan Beller, May 17, 2018
  70. 7/8 diff.c: add --color-moved-ignore-space-delta optionStefan Beller, May 17, 2018
  71. 8/8 diff: color-moved white space handling options imply color-movedStefan Beller, May 17, 2018
  72. 3/8 diff.c: do not pass diff options as keydata to hashmapStefan Beller, May 17, 2018
  73. 6/8 diff.c: decouple white space treatment from move detection algorithmStefan Beller, May 17, 2018
  74. Simon RuderichMay 18, 2018
  75. Stefan BellerMay 18, 2018
  76. Jonathan TanMay 17, 2018
  77. Jacob KellerJun 7, 2018
  78. Junio C HamanoMay 17, 2018
  79. Stefan BellerMay 17, 2018
  80. Junio C HamanoMay 17, 2018
  81. Stefan BellerMay 17, 2018
  82. brian m. carlsonMay 21, 2018
  83. Stefan BellerMay 21, 2018
  84. sb/submodule-move-nested breaks t7411 under GIT_FSMONITOR_TESTÆvar Arnfjörð Bjarmason, May 25, 2018
  85. Stefan BellerMay 25, 2018
  86. Stefan BellerMay 25, 2018
  87. Ævar Arnfjörð BjarmasonSep 6, 2018
  88. Stefan BellerSep 6, 2018
  89. Ben PeartSep 6, 2018
  90. Stefan BellerSep 6, 2018
  91. git-mv: allow submodules and fsmonitor to work togetherStefan Beller, Sep 6, 2018
  92. Ben PeartSep 10, 2018
  93. git-mv: allow submodules and fsmonitor to work togetherBen Peart, Sep 10, 2018
  94. Stefan BellerSep 10, 2018
  95. Ben PeartSep 10, 2018

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.