Re: [PATCH v3 2/6] builtin/repo: add helper for printing keyvalue output
- From
Justin Tobler <jltobler@gmail.com>
- Date
- Mar 3, 2026, 18:08 UTC
- Message-ID
- <aachrznSGC_gcElv@denethor>
- In-Reply-To
- <xmqq7brserq7.fsf@gitster.g>
On 26/03/03 09:40AM, Junio C Hamano wrote:
Show 16 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
>
> >> + print_keyvalue("references.branches.count", key_delim,
> >> + stats->refs.branches, value_delim);
> >> ...
> >
> > It's still easy to miss any mismatch here, but I guess the result is
> > definitely easier to read regardless of that.
>
> Sure, we could further do something silly like
>
> #define P(name, source) print_keyvalue(name, key_delim, source, value_delim)
>
> and reduce the above to
>
> P("references.branches.count", stats->refs.branches);This does indeed cut down on some of the boilerplate, which maybe would make it a little bit easier to catch any mismatches.
> if we wanted to.
Ultimately, I don't feel strongly either way though. I've amended locally, but will hold off on sending another version for now unless there is additional feedback.
Thanks, -Justin