X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=tag.c;h=e574c4b7a496d3a1d113801214197a04d5c74d42;hb=ad7db62113368279a1b6994790bf30925fabea33;hp=2b25fc0e1dc53234e38e8ed8fdc1cb99fa4fd84a;hpb=07ee0d77c66d6f356cd3f82435e67510779aa53c;p=git.git diff --git a/tag.c b/tag.c index 2b25fc0e..e574c4b7 100644 --- a/tag.c +++ b/tag.c @@ -3,6 +3,18 @@ const char *tag_type = "tag"; +struct object *deref_tag(struct object *o, const char *warn, int warnlen) +{ + while (o && o->type == tag_type) + o = parse_object(((struct tag *)o)->tagged->sha1); + if (!o && warn) { + if (!warnlen) + warnlen = strlen(warn); + error("missing object referenced by '%.*s'", warnlen, warn); + } + return o; +} + struct tag *lookup_tag(const unsigned char *sha1) { struct object *obj = lookup_object(sha1);