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

[PATCH] server-info: do not complain if a tag points at a non-commit.

From
Junio C Hamano <junkio@cox.net>
Date
Jul 29, 2005, 02:24 UTC
Message-ID
<7vr7diqri4.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.58.0507280040380.3227@g5.osdl.org>
Linux 2.6 tree has one of those tree tags.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 server-info.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
42fa3ca33f92381a73c08ab98dc4b54e6a6412cc
diff --git a/server-info.c b/server-info.c
--- a/server-info.c
+++ b/server-info.c
@@ -2,6 +2,7 @@
 #include "refs.h"
 #include "object.h"
 #include "commit.h"
+#include "tag.h"
 #include "rev-cache.h"
 
 /* refs */
@@ -518,10 +519,16 @@ static int update_info_packs(int force)
 /* rev-cache */
 static int record_rev_cache_ref(const char *path, const unsigned char *sha1)
 {
-	struct commit *commit;
-	if (!(commit = lookup_commit_reference(sha1)))
-		return error("not a commit: %s", sha1_to_hex(sha1));
-	return record_rev_cache(commit->object.sha1, NULL);
+	struct object *obj = parse_object(sha1);
+
+	if (!obj)
+		return error("ref %s has bad sha %s", path, sha1_to_hex(sha1));
+	while (obj && obj->type == tag_type)
+		obj = parse_object(((struct tag *)obj)->tagged->sha1);
+	if (!obj || obj->type != commit_type)
+		/* tag pointing at a non-commit */
+		return 0;
+	return record_rev_cache(obj->sha1, NULL);
 }
 
 static int update_info_revs(int force)
Message 1 of 1 in “server-info: do not complain if a tag points at a non-commit.”
  1. server-info: do not complain if a tag points at a non-commit.Junio C Hamano, Jul 29, 2005

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.