Re: [PATCH] git-for-each-ref: add new field name "symbolic"
- From
Jeff King <peff@peff.net>
- Date
- Feb 13, 2010, 08:51 UTC
- Message-ID
- <20100213085132.GA13181@coredump.intra.peff.net>
- In-Reply-To
- <7v4ollshn5.fsf@alter.siamese.dyndns.org>
On Fri, Feb 12, 2010 at 11:45:50PM -0800, Junio C Hamano wrote:
Show 13 quoted lines
> 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