{"thread":{"id":"1359","subject":"[PATCH] server-info: do not complain if a tag points at a non-commit.","startedAt":"2005-07-29T02:24:03Z","lastAt":"2005-07-29T02:24:03Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"6537","messageId":"7vr7diqri4.fsf@assigned-by-dhcp.cox.net","threadId":"1359","inReplyTo":"Pine.LNX.4.58.0507280040380.3227@g5.osdl.org","subject":"[PATCH] server-info: do not complain if a tag points at a non-commit.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-07-29T02:24:03Z","receivedAt":"2005-07-29T02:24:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linux 2.6 tree has one of those tree tags.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n server-info.c |   15 +++++++++++----\n 1 files changed, 11 insertions(+), 4 deletions(-)\n\n42fa3ca33f92381a73c08ab98dc4b54e6a6412cc\ndiff --git a/server-info.c b/server-info.c\n--- a/server-info.c\n+++ b/server-info.c\n@@ -2,6 +2,7 @@\n #include \"refs.h\"\n #include \"object.h\"\n #include \"commit.h\"\n+#include \"tag.h\"\n #include \"rev-cache.h\"\n \n /* refs */\n@@ -518,10 +519,16 @@ static int update_info_packs(int force)\n /* rev-cache */\n static int record_rev_cache_ref(const char *path, const unsigned char *sha1)\n {\n-\tstruct commit *commit;\n-\tif (!(commit = lookup_commit_reference(sha1)))\n-\t\treturn error(\"not a commit: %s\", sha1_to_hex(sha1));\n-\treturn record_rev_cache(commit->object.sha1, NULL);\n+\tstruct object *obj = parse_object(sha1);\n+\n+\tif (!obj)\n+\t\treturn error(\"ref %s has bad sha %s\", path, sha1_to_hex(sha1));\n+\twhile (obj && obj->type == tag_type)\n+\t\tobj = parse_object(((struct tag *)obj)->tagged->sha1);\n+\tif (!obj || obj->type != commit_type)\n+\t\t/* tag pointing at a non-commit */\n+\t\treturn 0;\n+\treturn record_rev_cache(obj->sha1, NULL);\n }\n \n static int update_info_revs(int force)\n"}]}