Re: [PATCH 2/2] branch, for-each-ref: add option to omit empty lines
From: Jeff King <hidden>
Date: 2023-03-30 18:25:07
From: Jeff King <hidden>
Date: 2023-03-30 18:25:07
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. (The rest of your review seemed quite sensible to me, and I like the idea of the omit-empty option in general). -Peff