git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Larry D'Anna <larry@elder-gods.org>, git@vger.kernel.org
Subject: Re: [PATCH] git-for-each-ref: add new field name "symbolic"
Date: Sat, 13 Feb 2010 03:51:32 -0500	[thread overview]
Message-ID: <20100213085132.GA13181@coredump.intra.peff.net> (raw)
In-Reply-To: <7v4ollshn5.fsf@alter.siamese.dyndns.org>

On Fri, Feb 12, 2010 at 11:45:50PM -0800, Junio C Hamano wrote:

> Larry D'Anna <larry@elder-gods.org> writes:
> 
> > %(symbolic) will expand to "true" for symbolic refs, and "false" otherwise.
> > This is a lot faster than calling git-symbolic-ref on every single ref from your
> > shell script.
> 
> I think this is a good idea, but I suspect that much more than half of
> people who iterate over for-each-ref output and run symbolic-ref would
> actually want to learn what actual ref a symbolic one points at.  So you
> may not be helping as much people as you could by going in this direction.
> 
> Instead of expanding to "true", why not make it show the expansion if it
> is symbolic, and to empty if it is not?

That was my first thought, too. Unfortunately it needs some pretty heavy
refactoring of the for_each_ref call chain, as we throw away the
dereferenced ref name at the very bottom.

So while I would be in favor of a real "%(symbolic)" as you describe, it
is significantly more work. If we are just going to do a flag check,
though, I would much rather see it called "%(issymbolic)" or something
so that "%(symbolic)" can be used later for the actual value.

One other alternative would be to simply expose "%(flags)" which would
expand to nothing, "symbolic", "packed", or "symbolic,packed".

-Peff

  reply	other threads:[~2010-02-13  8:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-13  5:55 [PATCH] git-for-each-ref: add new field name "symbolic" Larry D'Anna
2010-02-13  7:45 ` Junio C Hamano
2010-02-13  8:51   ` Jeff King [this message]
2010-02-13 20:30     ` [PATCH 0/4] for-each-ref --format='%(symref) %(symref:short) %(flag)' Junio C Hamano
2010-02-13 20:30       ` [PATCH 1/4] builtin-for-each-ref.c: comment fixes Junio C Hamano
2010-02-13 20:30       ` [PATCH 2/4] builtin-for-each-ref.c: check if we need to peel onion while parsing the format Junio C Hamano
2010-02-13 20:30       ` [PATCH 3/4] for-each-ref --format='%(symref) %(symref:short)' Junio C Hamano
2010-02-14  6:32         ` Jeff King
2010-02-14 10:32           ` Junio C Hamano
2010-02-15  8:39             ` Jeff King
2010-02-13 20:30       ` [PATCH 4/4] for-each-ref --format='%(flag)' Junio C Hamano

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=20100213085132.GA13181@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=larry@elder-gods.org \
    /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 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 NNTP newsgroup(s).