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

[PATCH] Fix describe --tags --long so it does not segfault

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jul 3, 2008, 02:32 UTC
Message-ID
<20080703023245.GA31579@spearce.org>
In-Reply-To
<237967ef0807021256j3e67bceaoecbb8f37112db2ab@mail.gmail.com>

If we match a lightweight (non-annotated tag) as the name to output and --long was requested we do not have a tag, nor do we have a tagged object to display. Instead we must use the object we were passed as input for the long format display.

Reported-by: Mark Burton <markb@ordern.com>
Backtraced-by: Mikael Magnusson <mikachu@gmail.com>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 Thanks Mikael, the backtrace really made it easy to figure out
 what the breakage was here.
 builtin-describe.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-describe.c b/builtin-describe.c
index 3da99c1..e515f9c 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -204,7 +204,7 @@ static void describe(const char *arg, int last_one)
 		 */
 		display_name(n);
 		if (longformat)
-			show_suffix(0, n->tag->tagged->sha1);
+			show_suffix(0, n->tag ? n->tag->tagged->sha1 : sha1);
 		printf("\n");
 		return;
 	}
-- 
1.5.6.74.g8a5e
Previous: Mikael MagnussonNext: Junio C Hamano
Message 3 of 5 in “git describe --tags --long barfs on new tags?”
  1. Mark BurtonJul 2, 2008
  2. Mikael MagnussonJul 2, 2008
  3. Fix describe --tags --long so it does not segfaultShawn O. Pearce, Jul 3, 2008
  4. Junio C HamanoJul 3, 2008
  5. Abhijit Menon-SenJul 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.