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

Trouble with cat-file on tags

From
Sebastian Schuberth <sschuberth@gmail.com>
Date
Apr 1, 2016, 09:26 UTC
Message-ID
<ndlesh$dj1$1@ger.gmane.org>
Hi,
I was trying to use cat-file to get the hash of a tag object (not the hash of the commit object the tag points to), and I'm running into some issues. At the example of a cloned gerry [1] repository:

---8<--- $ git tag test-tag

$ git tag -l test-tag v0.0.3 v0.0.4 v0.1.0 v0.1.1 v0.1.2

$ git cat-file tag refs/tags/test-tag fatal: git cat-file refs/tags/test-tag: bad file ---8<---

So for a newly created local tag, cat-file does not seem to work. However:

---8<--- $ git cat-file tag refs/tags/v0.1.2 object 91b0d21eba039e5ba0a90104c9c485735576dcbf type commit tag v0.1.2 tagger Travis Truman <travis_truman@cable.comcast.com> 1452693317 -0500

Version 0.1.2 ---8<---

For an existing tag, git-file suddenly *does* seem to work, although I'm puzzled why I'm getting info on the commit object here. I thought "cat-file tag" should explicitly make "cat-file" list information about the tag object itself, not about the commit object the tag points to.
Thoughts?
[1] https://github.com/trumant/gerry

Regards, Sebastian

Next: Sebastian Schuberth
Message 1 of 4 in “Trouble with cat-file on tags”
  1. Sebastian SchuberthApr 1, 2016
  2. Sebastian SchuberthApr 1, 2016
  3. Sebastian SchuberthApr 1, 2016
  4. Jeff KingApr 1, 2016

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.