Re: [RFC PATCH 1/1] for-each-ref: do not output empty lines

2019-09-10 Thread Jeff King
On Mon, Sep 09, 2019 at 11:02:07PM -0700, Junio C Hamano wrote: > Eric Freese writes: > > > If the format string expands to an empty string for a given ref, do not > > print the empty line. > > > > This is helpful when wanting to print only certain kinds of refs that > > you can't already filter

Re: [RFC PATCH 1/1] for-each-ref: do not output empty lines

2019-09-09 Thread Junio C Hamano
Junio C Hamano writes: >> fwrite(final_buf.buf, 1, final_buf.len, stdout); >> +if (final_buf.len) >> +putchar('\n'); > > While we are introducing a conditional, let's drop the useless > fwrite of 0-byte while we are at it [*1*], i.e. > > if (final_buf.len && !omit_empty

Re: [RFC PATCH 1/1] for-each-ref: do not output empty lines

2019-09-09 Thread Junio C Hamano
Eric Freese writes: > If the format string expands to an empty string for a given ref, do not > print the empty line. > > This is helpful when wanting to print only certain kinds of refs that > you can't already filter for. We tend to prefer stating the reason why we want to do so first and then