git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Eric Freese <ericdfreese@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [RFC PATCH 1/1] for-each-ref: add '--no-symbolic' option
Date: Mon, 9 Sep 2019 08:57:53 -0400	[thread overview]
Message-ID: <20190909125753.GA8684@sigill.intra.peff.net> (raw)
In-Reply-To: <CAAikoA+MvORDJ6y=VSk_1s6v7110UeOfU2X2G7=9ChV+m+COxQ@mail.gmail.com>

On Sun, Sep 08, 2019 at 10:01:33PM -0600, Eric Freese wrote:

> On Sun, Sep 9, 2019 at 4:34 PM Junio C Hamano <gitster@pobox.com> wrote:
> 
> > I guess with "%(if)...%(then)...%(else)...%(end)" you might be able
> > to do either one of --include/--exclude without supporting the
> > other, e.g. "--include='%(if)%(symref)%(then)%(else)not a
> > symref%(end)" would be usable as "I do not want to see symrefs" in a
> > system that supports only "--include" without "--exclude".
> 
> This has made me realize that I can get the behavior I need by using `%(if)`.
> 
> Exclude symrefs:
>   "%(if)%(symref)%(then)%(else)%(refname)%(end)"
> 
> Only symrefs:
>   "%(if)%(symref)%(then)%(refname)%(end)"
> 
> However, this still prints an empty line for each ref that does not match the
> condition. This can be cleaned up by piping through `grep .`, but what would
> you think of adding a new optional flag to git-for-each-ref to prevent it from
> printing empty expanded format strings?

Yeah, I think that is a much nicer direction, in that it covers many
more cases. I'm tempted to suggest it should even be the default, since
the blank lines are mostly useless (by definition they carry no
information except the single bit of "there was a ref that didn't have
any output for your format").

My only reservation is that for-each-ref is plumbing, and it's
_possible_ somebody is counting up the blank lines as part of some
workflow (say, counting up tags and non-tags). It seems kind of
unlikely, though. Much more likely is having an output format that has
some non-blank elements and some blank, but the proposal wouldn't change
the behavior there at all.

-Peff

  reply	other threads:[~2019-09-09 12:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-07 21:36 [RFC PATCH 0/1] for-each-ref: Add '--no-symbolic' option Eric Freese
2019-09-07 21:36 ` [RFC PATCH 1/1] for-each-ref: add " Eric Freese
2019-09-07 23:28   ` Taylor Blau
2019-09-07 23:39     ` Taylor Blau
2019-09-08  9:44     ` Jeff King
2019-09-07 23:37   ` Taylor Blau
2019-09-08 10:05   ` Jeff King
2019-09-08 15:40     ` Junio C Hamano
2019-09-08 22:34       ` Junio C Hamano
2019-09-09  4:01         ` Eric Freese
2019-09-09 12:57           ` Jeff King [this message]
2019-09-09 18:08           ` Junio C Hamano
2019-09-07 23:16 ` [RFC PATCH 0/1] for-each-ref: Add " Taylor Blau

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20190909125753.GA8684@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).