Thread View: linux.kernel.git
7 messages
7 total messages
Started by Antoni Borowski
Tue, 13 Oct 2026 20:43
[Microproject] describe: pluralize tag/commit count messages
Author: Antoni Borowski
Date: Tue, 13 Oct 2026 20:43
Date: Tue, 13 Oct 2026 20:43
35 lines
9005 bytes
9005 bytes
These two verbose messages hardcoded the English plural form
("tags"/"commits") inside _(), which is wrong both grammatically
(e.g. "found 1 tags") and for i18n, since other languages have
different plural rules than English.
Switch both to Q_() so gettext picks the correct singular/plural
form based on the count.
Signed-off-by: Antoni Borowski <antekborowski11@gmail.com>
---
builtin/describe.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/builtin/describe.c b/builtin/describe.c
index c0abc931a5..9fbb982417 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -481,10 +481,12 @@ static void describe_commit(struct commit *cmit, struct strbuf *dst)
label_width, _(prio_names[t->name->prio]),
t->depth, t->name->path);
}
- fprintf(stderr, _("traversed %lu commits\n"), seen_commits);
+ fprintf(stderr, Q_("traversed %lu commit\n",
+ "traversed %lu commits\n", seen_commits), seen_commits);
if (gave_up_on) {
fprintf(stderr,
- _("found %i tags; gave up search at %s\n"),
+ Q_("found %i tag; gave up search at %s\n",
+ "found %i tags; gave up search at %s\n", max_candidates),
max_candidates,
oid_to_hex(&gave_up_on->object.oid));
}
--
2.56.0
Re: [Microproject] describe: pluralize tag/commit count messages
Author: Junio C Hamano
Date: Wed, 14 Oct 2026 17:36
Date: Wed, 14 Oct 2026 17:36
16 lines
10198 bytes
10198 bytes
Jeff King <peff@peff.net> writes: > OK. The patch looks obviously correct, though I do find it a little > funny that we bother to translate these debug messages in the first > place. > > I wonder if there is even really value in keeping "--debug" here at all. > But that is a somewhat bigger change. > > The patch here seems OK to me in the meantime (and totally fine for a > microproject). Yeah, but a microproject that convincingly argues that output from the "--debug" option should not even be translated and undoes _() would make a much better case to see how a new person works well ;-).
[Microproject] describe: do not translate --debug output
Author: Antoni Borowski
Date: Fri, 16 Oct 2026 17:18
Date: Fri, 16 Oct 2026 17:18
70 lines
10658 bytes
10658 bytes
The --debug flag is aimed at developers debugging describe's search
strategy, not at end users. Translating this output makes it harder
to grep for known strings, compare logs across locales, or paste
output into upstream bug reports written in English — all things
developers routinely need to do.
transport-helper.c already follows this convention: its "Debug: ..."
messages are plain C strings with no gettext wrapper.
Drop the _() and Q_() wrappers from describe_commit()'s debug-only
fprintf() calls accordingly, and prefix them with "Debug: " to match
transport-helper.c's style.
Signed-off-by: Antoni Borowski <antekborowski11@gmail.com>
---
builtin/describe.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/builtin/describe.c b/builtin/describe.c
index c0abc931a5..775f9f27f1 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -351,7 +351,7 @@ static void describe_commit(struct commit *cmit, struct strbuf *dst)
if (!max_candidates)
die(_("no tag exactly matches '%s'"), oid_to_hex(&cmit->object.oid));
if (debug)
- fprintf(stderr, _("No exact match on refs or tags, searching to describe\n"));
+ fprintf(stderr, "Debug: No exact match on refs or tags, searching to describe\n");
if (!have_util) {
struct hashmap_iter iter;
@@ -419,7 +419,7 @@ static void describe_commit(struct commit *cmit, struct strbuf *dst)
}
if ((c->object.flags & best_within) == best_within) {
if (debug)
- fprintf(stderr, _("finished search at %s\n"),
+ fprintf(stderr, "Debug: finished search at %s\n",
oid_to_hex(&c->object.oid));
break;
}
@@ -477,14 +477,14 @@ static void describe_commit(struct commit *cmit, struct strbuf *dst)
}
for (cur_match = 0; cur_match < match_cnt; cur_match++) {
struct possible_tag *t = &all_matches[cur_match];
- fprintf(stderr, " %-*s %8d %s\n",
+ fprintf(stderr, "Debug: %-*s %8d %s\n",
label_width, _(prio_names[t->name->prio]),
t->depth, t->name->path);
}
- fprintf(stderr, _("traversed %lu commits\n"), seen_commits);
+ fprintf(stderr, "Debug: traversed %lu commits\n", seen_commits);
if (gave_up_on) {
fprintf(stderr,
- _("found %i tags; gave up search at %s\n"),
+ "Debug: found %i tags; gave up search at %s\n",
max_candidates,
oid_to_hex(&gave_up_on->object.oid));
}
@@ -565,7 +565,7 @@ static void describe(const char *arg, int last_one)
struct strbuf sb = STRBUF_INIT;
if (debug)
- fprintf(stderr, _("describe %s\n"), arg);
+ fprintf(stderr, "Debug: describe %s\n", arg);
if (repo_get_oid(the_repository, arg, &oid))
die(_("Not a valid object name %s"), arg);
--
2.56.0
Re: [Microproject] describe: do not translate --debug output
Author: Junio C Hamano
Date: Fri, 16 Oct 2026 18:35
Date: Fri, 16 Oct 2026 18:35
75 lines
12696 bytes
12696 bytes
Antoni Borowski <antekborowski11@gmail.com> writes:
> The --debug flag is aimed at developers debugging describe's search
> strategy, not at end users. Translating this output makes it harder
> to grep for known strings, compare logs across locales, or paste
> output into upstream bug reports written in English — all things
> developers routinely need to do.
>
> transport-helper.c already follows this convention: its "Debug: ..."
> messages are plain C strings with no gettext wrapper.
>
> Drop the _() and Q_() wrappers from describe_commit()'s debug-only
> fprintf() calls accordingly, and prefix them with "Debug: " to match
> transport-helper.c's style.
Nicely described. One nit in the proposed log message is that you
are not removing any Q_() at all ;-).
> Signed-off-by: Antoni Borowski <antekborowski11@gmail.com>
> ---
> builtin/describe.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
> diff --git a/builtin/describe.c b/builtin/describe.c
> index c0abc931a5..775f9f27f1 100644
> --- a/builtin/describe.c
> +++ b/builtin/describe.c
> @@ -351,7 +351,7 @@ static void describe_commit(struct commit *cmit, struct strbuf *dst)
> if (!max_candidates)
> die(_("no tag exactly matches '%s'"), oid_to_hex(&cmit->object.oid));
> if (debug)
> - fprintf(stderr, _("No exact match on refs or tags, searching to describe\n"));
> + fprintf(stderr, "Debug: No exact match on refs or tags, searching to describe\n");
>
> if (!have_util) {
> struct hashmap_iter iter;
> @@ -419,7 +419,7 @@ static void describe_commit(struct commit *cmit, struct strbuf *dst)
> }
> if ((c->object.flags & best_within) == best_within) {
> if (debug)
> - fprintf(stderr, _("finished search at %s\n"),
> + fprintf(stderr, "Debug: finished search at %s\n",
> oid_to_hex(&c->object.oid));
> break;
> }
> @@ -477,14 +477,14 @@ static void describe_commit(struct commit *cmit, struct strbuf *dst)
> }
> for (cur_match = 0; cur_match < match_cnt; cur_match++) {
> struct possible_tag *t = &all_matches[cur_match];
> - fprintf(stderr, " %-*s %8d %s\n",
> + fprintf(stderr, "Debug: %-*s %8d %s\n",
> label_width, _(prio_names[t->name->prio]),
> t->depth, t->name->path);
> }
> - fprintf(stderr, _("traversed %lu commits\n"), seen_commits);
> + fprintf(stderr, "Debug: traversed %lu commits\n", seen_commits);
> if (gave_up_on) {
> fprintf(stderr,
> - _("found %i tags; gave up search at %s\n"),
> + "Debug: found %i tags; gave up search at %s\n",
> max_candidates,
> oid_to_hex(&gave_up_on->object.oid));
> }
> @@ -565,7 +565,7 @@ static void describe(const char *arg, int last_one)
> struct strbuf sb = STRBUF_INIT;
>
> if (debug)
> - fprintf(stderr, _("describe %s\n"), arg);
> + fprintf(stderr, "Debug: describe %s\n", arg);
>
> if (repo_get_oid(the_repository, arg, &oid))
> die(_("Not a valid object name %s"), arg);
[Microproject v2] describe: do not translate --debug output
Author: Antoni Borowski
Date: Fri, 16 Oct 2026 18:54
Date: Fri, 16 Oct 2026 18:54
74 lines
10706 bytes
10706 bytes
The --debug flag is aimed at developers debugging describe's search
strategy, not at end users. Translating this output makes it harder
to grep for known strings, compare logs across locales, or paste
output into upstream bug reports written in English — all things
developers routinely need to do.
transport-helper.c already follows this convention: its "Debug: ..."
messages are plain C strings with no gettext wrapper.
Drop the _() wrapper from describe_commit()'s and describe()'s
debug-only fprintf() calls accordingly, and prefix them with
"Debug: " to match transport-helper.c's style.
Signed-off-by: Antoni Borowski <antekborowski11@gmail.com>
---
builtin/describe.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/builtin/describe.c b/builtin/describe.c
index c0abc931a5..775f9f27f1 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -351,7 +351,7 @@ static void describe_commit(struct commit *cmit, struct strbuf *dst)
if (!max_candidates)
die(_("no tag exactly matches '%s'"), oid_to_hex(&cmit->object.oid));
if (debug)
- fprintf(stderr, _("No exact match on refs or tags, searching to describe\n"));
+ fprintf(stderr, "Debug: No exact match on refs or tags, searching to describe\n");
if (!have_util) {
struct hashmap_iter iter;
@@ -419,7 +419,7 @@ static void describe_commit(struct commit *cmit, struct strbuf *dst)
}
if ((c->object.flags & best_within) == best_within) {
if (debug)
- fprintf(stderr, _("finished search at %s\n"),
+ fprintf(stderr, "Debug: finished search at %s\n",
oid_to_hex(&c->object.oid));
break;
}
@@ -477,14 +477,14 @@ static void describe_commit(struct commit *cmit, struct strbuf *dst)
}
for (cur_match = 0; cur_match < match_cnt; cur_match++) {
struct possible_tag *t = &all_matches[cur_match];
- fprintf(stderr, " %-*s %8d %s\n",
+ fprintf(stderr, "Debug: %-*s %8d %s\n",
label_width, _(prio_names[t->name->prio]),
t->depth, t->name->path);
}
- fprintf(stderr, _("traversed %lu commits\n"), seen_commits);
+ fprintf(stderr, "Debug: traversed %lu commits\n", seen_commits);
if (gave_up_on) {
fprintf(stderr,
- _("found %i tags; gave up search at %s\n"),
+ "Debug: found %i tags; gave up search at %s\n",
max_candidates,
oid_to_hex(&gave_up_on->object.oid));
}
@@ -565,7 +565,7 @@ static void describe(const char *arg, int last_one)
struct strbuf sb = STRBUF_INIT;
if (debug)
- fprintf(stderr, _("describe %s\n"), arg);
+ fprintf(stderr, "Debug: describe %s\n", arg);
if (repo_get_oid(the_repository, arg, &oid))
die(_("Not a valid object name %s"), arg);
--
2.56.0
---
v2: fixed commit message, no Q_() was actually touched
Re: [Microproject v2] describe: do not translate --debug output
Author: Junio C Hamano
Date: Sat, 07 Nov 2026 02:23
Date: Sat, 07 Nov 2026 02:23
29 lines
13800 bytes
13800 bytes
Antoni Borowski <antekborowski11@gmail.com> writes:
> The --debug flag is aimed at developers debugging describe's search
> strategy, not at end users. Translating this output makes it harder
> to grep for known strings, compare logs across locales, or paste
> output into upstream bug reports written in English — all things
> developers routinely need to do.
>
> transport-helper.c already follows this convention: its "Debug: ..."
> messages are plain C strings with no gettext wrapper.
>
> Drop the _() wrapper from describe_commit()'s and describe()'s
> debug-only fprintf() calls accordingly, and prefix them with
> "Debug: " to match transport-helper.c's style.
>
> Signed-off-by: Antoni Borowski <antekborowski11@gmail.com>
> ---
> builtin/describe.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
OK, looking good.
Let's mark the topic as ready for 'next'.
> - fprintf(stderr, _("No exact match on refs or tags, searching to describe\n"));
> + fprintf(stderr, "Debug: No exact match on refs or tags, searching to describe\n");
Shame we do not have debugf() macro ;-)
Re: [Microproject v2] describe: do not translate --debug output
Author: Junio C Hamano
Date: Sat, 07 Nov 2026 04:56
Date: Sat, 07 Nov 2026 04:56
35 lines
13885 bytes
13885 bytes
Antoni Borowski <antekborowski11@gmail.com> writes:
> @@ -477,14 +477,14 @@ static void describe_commit(struct commit *cmit, struct strbuf *dst)
> }
> for (cur_match = 0; cur_match < match_cnt; cur_match++) {
> struct possible_tag *t = &all_matches[cur_match];
> - fprintf(stderr, " %-*s %8d %s\n",
> + fprintf(stderr, "Debug: %-*s %8d %s\n",
> label_width, _(prio_names[t->name->prio]),
> t->depth, t->name->path);
> }
This one has _(translation) still lurking here. prio_names[] should
not be translated.
prio_names[] is defined as file-scope static.
static const char *prio_names[] = {
N_("head"), N_("lightweight"), N_("annotated"),
};
In describe_commit(), the length of _(prio_names[]) is measured only
for debugging purposes (which is outside the pre-context of the
above hunk), and they are shown with the fprintf() we see above.
The values in prio_names[] should lose N_() around them, and all _()
around prio_names[] should bbe removed to make this conversion
complete. Perhaps prio_names[] should be moved to that if (debug)
block, which is the only user of that array. It may even make sense
to rename prio_names[] to make it clear that it is only used for
debugging output and nothing else.
So, earlier I said this looks ready for 'next', but no, it still
needs a bit more work.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads