Re: [PATCH 2/2] branch, for-each-ref: add option to omit empty lines
Jeff King <peff@peff.net> writes:
Show 15 quoted lines
> On Thu, Mar 30, 2023 at 08:54:35AM -0700, Junio C Hamano wrote:
>
>> * now we care if output is empty anyway, perhaps we can optimize
>> out fwrite() too, perhaps with something like
>>
>> if (output.len || !omit_empty)
>> printf("%.*s\n", output.len, output.buf);
>>
>> perhaps?
>>
>> I am not sure about the latter, but we tend to use "%.*s" liberally
>> when we could use fwrite() in our codebase for brevity, so ...
>
> I think it would be a mistake here, as you can use "%00" in the format
> to include a NUL in the output.Good point. Thanks for catching it.
Show 5 quoted lines
>
> (The rest of your review seemed quite sensible to me, and I like the
> idea of the omit-empty option in general).
>
> -Peff