Re: Unify annotated and non-annotated tags
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 11, 2017, 02:06 UTC
- Message-ID
- <xmqqh8u1efh5.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <ec4be1c2-a0cc-cec8-a566-06c11c8abe06@gmail.com>
Igor Djordjevic <igor.d.djordjevic@gmail.com> writes:
Show 11 quoted lines
> If you would like to mimic output of "git show-ref", repeating > commits for each tag pointing to it and showing full tag name as > well, you could do something like this, for example: > > for tag in $(git for-each-ref --format="%(refname)" refs/tags) > do > printf '%s %s\n' "$(git rev-parse $tag^0)" "$tag" > done > > > Hope that helps a bit.
If you use for-each-ref's --format option, you could do something like (pardon a long line):
git for-each-ref --format='%(if)%(*objectname)%(then)%(*objectname)%(else)%(objectname)%(end) %(refname)' refs/tags
without any loop, I would think.