X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=server-info.c;h=2b3aecab4aa0df4125f401219f06ea04577cacca;hb=8ceba720ba5e5e76384e46629e599124c6f36409;hp=00f8ca0c585ce3bc5a84f4977d1bca364508a714;hpb=8f3f9b09dc5ac8a946422422c3c70a4a4c284be3;p=git.git diff --git a/server-info.c b/server-info.c index 00f8ca0c..2b3aecab 100644 --- 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 */ @@ -61,7 +62,7 @@ static int update_info_refs(int force) } /* packs */ -struct pack_info { +static struct pack_info { unsigned long latest; struct packed_git *p; int old_num; @@ -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)