Small bugfixes for http-push.c
[git.git] / tag.c
diff --git a/tag.c b/tag.c
index 2b25fc0..e574c4b 100644 (file)
--- 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);