Re: [PATCH 2/6] builtin/repo: humanise count values in structure output
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 11, 2025, 02:57 UTC
- Message-ID
- <xmqq1pl1hgj4.fsf@gitster.g>
- In-Reply-To
- <kf7vavs5yetooe6u2ygttzfriul4u5ywdnhtyksh2pbar4mpfz@orlg7ppajd7s>
Justin Tobler <jltobler@gmail.com> writes:
Show 21 quoted lines
> On 25/12/10 07:28AM, Patrick Steinhardt wrote:
>> On Tue, Dec 09, 2025 at 04:58:16PM -0600, Justin Tobler wrote:
>> > diff --git a/builtin/repo.c b/builtin/repo.c
>> > index a69699857a..8fb728b3a5 100644
>> > --- a/builtin/repo.c
>> > +++ b/builtin/repo.c
>> > @@ -266,6 +275,10 @@ static void stats_table_addf(struct stats_table *table, const char *format, ...)
>> > va_end(ap);
>> > }
>> >
>> > +static const char *unit_k = "k";
>> > +static const char *unit_M = "M";
>> > +static const char *unit_G = "G";
>> > +
>> > static void stats_table_count_addf(struct stats_table *table, size_t value,
>> > const char *format, ...)
>> > {
>>
>> I would assume that these units should be translatable.
>
> Ya, you are right. I'll make units translatable in the next version.Whatever you do, please first consider reusing existing "human-readable numbers" helpers, like strbuf_humanise_bytes() used by the progress.c for showing throughput, before rolling your own variant like the above.
Thanks.