git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Unify annotated and non-annotated tags

From
anatoly techtonik <techtonik@gmail.com>
Date
Nov 23, 2017, 07:31 UTC
Message-ID
<CAPkN8xJU74N_kYL9f2v_vuk3C3omhYaz7uPMzbanEU=RTEPOYg@mail.gmail.com>
In-Reply-To
<xmqqh8u1efh5.fsf@gitster.mtv.corp.google.com>
On Sat, Nov 11, 2017 at 5:06 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 20 quoted lines
> Igor Djordjevic <igor.d.djordjevic@gmail.com> writes:
>
>> 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.
Thanks. That helps.

So my proposal is to get rid of non-annotated tags, so to get all tags with commits that they point to, one would use:

git for-each-ref --format='%(*objectname) %(refname)' refs/tags

For so-called non-annotated tags just leave the message empty. I don't see why anyone would need non-annotated tags though.

-- 
anatoly t.
Previous: Igor DjordjevicNext: anatoly techtonik
Message 5 of 6 in “Unify annotated and non-annotated tags”
  1. anatoly techtonikNov 10, 2017
  2. Igor DjordjevicNov 11, 2017
  3. Junio C HamanoNov 11, 2017
  4. Igor DjordjevicNov 11, 2017
  5. anatoly techtonikNov 23, 2017
  6. anatoly techtonikDec 23, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.