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

git-describe: use tags found in packed-refs correctly

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 3, 2008, 17:13 UTC
Message-ID
<7vejarivc8.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20080228062236.GA15845@spearce.org>

When your refs are packed, "git-describe" can find the tag that is the best match without ever parsing the tag itself. But lookup_tag() in display_name() says "I've never seen it", creates an empty shell, and returns it. We need to make sure that we actually have parsed the tag data into it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin-describe.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-describe.c b/builtin-describe.c
index 2f1e7ba..c549d36 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -156,7 +156,7 @@ static void display_name(struct commit_name *n)
 {
 	if (n->prio == 2 && !n->tag) {
 		n->tag = lookup_tag(n->sha1);
-		if (!n->tag || !n->tag->tag)
+		if (parse_tag(n->tag) || !n->tag || !n->tag->tag)
 			die("annotated tag %s not available", n->path);
 		if (strcmp(n->tag->tag, n->path))
 			warning("tag '%s' is really '%s' here", n->tag->tag, n->path);
Previous: Shawn O. Pearce
Message 2 of 2 in “Teach git-describe to verify annotated tag names before output”
  1. Teach git-describe to verify annotated tag names before outputShawn O. Pearce, Feb 28, 2008
  2. git-describe: use tags found in packed-refs correctlyJunio C Hamano, Mar 3, 2008

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.