All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Eric Freese <ericdfreese@gmail.com>, git@vger.kernel.org
Subject: Re: [RFC PATCH 1/1] for-each-ref: do not output empty lines
Date: Tue, 10 Sep 2019 12:35:42 -0400	[thread overview]
Message-ID: <20190910163541.GA13873@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqpnk8heow.fsf@gitster-ct.c.googlers.com>

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

> Eric Freese <ericdfreese@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

      parent reply	other threads:[~2019-09-10 16:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-10  5:17 [RFC PATCH 0/1] for-each-ref: do not output empty lines Eric Freese
2019-09-10  5:17 ` [RFC PATCH 1/1] " Eric Freese
2019-09-10  6:02   ` Junio C Hamano
2019-09-10  6:14     ` Junio C Hamano
2019-09-10 16:35     ` Jeff King [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190910163541.GA13873@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=ericdfreese@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.