RFC usage: prefix all lines in `vreportf()`, not just the first
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest3 patches 19 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | usage: extract `prefix_suffix_lines()` from `advise()`advice.c git-compat-util.h usage.c | +34 | 8 replies | |
| 2/3 | usage: prefix all lines in `vreportf()`, not just the firstt/ t/ t/ +5 more | +51 | 11 replies | |
| 3/3 | usage: translate the "error: "-prefix and othersusage.c | +4 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC PATCH 0/3] usage: prefix all lines in `vreportf()`, not just the first
Quoted 9 lines · Junio C Hamano
Quoted 3 lines · Junio C Hamano
Review
Quoted 3 lines
(quoted diff) +3
-0+ 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
[...]
Quoted 3 lines
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)."));
[...]
Quoted 11 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(-)
Signature · 1 line
2.17.0.1181.g093e983b05