Re: [PATCH] show-ref: add --unresolved option
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 6, 2024, 16:48 UTC
- Message-ID
- <xmqq34t3tifv.fsf@gitster.g>
- In-Reply-To
- <20240306075128.GA4099518@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> You can do: > > git for-each-ref --format='%(refname) %(objectname) %(symref)'
We can even do that "ref target || object name" thing with
--format='%(refname) %(if)%(symref)%(then)%(symref)%(else)%(objectname)'
if we wanted to. But if we have both available, I think the output that adds the symref target, if available, after the object name, is better than the output that switches between the two.
> to get the resolved values next to the symrefs (if any). I think that > does a full resolution, though (so again, if you had one->two->three, > you can never learn about the intermediate "two").
Yeah, I know we discussed the usefulness of tag-of-tag-of-something, but this is a similar one.
> I think for-each-ref in the above command works by calling > resolve_refdup() itself, and then recording the result. It would be nice > to get it from the iterator, though (more efficient, and avoids any > races).
Indeed. Thanks for an interesting thought.