On Mon, Sep 09, 2019 at 11:02:07PM -0700, Junio C Hamano wrote:

> Eric Freese <ericdfre...@gmail.com> 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 give a command to the codebase to "become like so".  Here is to
> illustrate how you would do it:
> 
>     The custom format specifier "--format=<format>" can be used to
>     tell the for-each-ref command to say nothing for certain kind of
>     refs, e.g.
> 
>        --format="%(if)%(symref)%(then)%(else)%(refname)%(end)"
> 
>     may be used to show the refname only for refs that are not
>     symbolic refs.  Except that the command still would show one
>     blank line per each symbolic ref, which is fairly useless.
> 
>     Introduce the `--omit-empty-lines` option to squelch these
>     useless lines from the output.

Your proposed commit message (and the suggested code below) have a
command-line option, but Eric's patch does it by default. Which do we
want? :)

I'm inclined to say that this new behavior should be the default; even
though it's technically a compatibility change, I find it hard to
imagine people would see it as a regression.

But we could also introduce "--omit-empty-lines", and then flip the
default. That gives an escape hatch of "--no-omit-empty-lines", at the
minor cost of having to carry an option that we assume nobody would ever
use.

-Peff

Reply via email to