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

Unify annotated and non-annotated tags

From
anatoly techtonik <techtonik@gmail.com>
Date
Nov 10, 2017, 10:58 UTC
Message-ID
<CAPkN8x+MELCnttE+xptKzYXsYPWqbiE59LABrwNBhFroayc+wQ@mail.gmail.com>
Hi,

It is hard to work with Git tags, because on low level hash of non-annotated tag is pointing to commit, but hash for annotated tag is pointing to tag metadata.

On low level that means that there is no way to get commit hash from tag in a single step. If tag is annotated, you need to find and parse ^{} string of show-ref, if not, then look for string without ^{}.

So, why not just make all tags work the same so that every tag has its own hash and you need to dereference it in the same way to get commit hash?

This way I could get all commit hashes with just:
    git show-ref --tags -d | grep "\^{}"
or abandon ^{} completely and show commit hashes on -d:
    git show-ref --tags --dereference
-- 
anatoly t.
Next: Igor Djordjevic
Message 1 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.