X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=tag.c;h=bbacd59a23f7994980f4bf017324833ca3d4adb3;hb=d1c7cd13dc7839b3c0b4d56a84f9effc9976144e;hp=56a49f4fe1f705ee70bc5318a504c35d1bce963e;hpb=7f09ac4714214d1dc12877cc98fb69cdee22e33e;p=git.git diff --git a/tag.c b/tag.c index 56a49f4fe..bbacd59a2 100644 --- a/tag.c +++ b/tag.c @@ -20,17 +20,13 @@ struct object *deref_tag(struct object *o, const char *warn, int warnlen) struct tag *lookup_tag(const unsigned char *sha1) { - struct object *obj = lookup_object(sha1); - if (!obj) { - struct tag *ret = alloc_tag_node(); - created_object(sha1, &ret->object); - ret->object.type = OBJ_TAG; - return ret; - } + struct object *obj = lookup_object(sha1); + if (!obj) + return create_object(sha1, OBJ_TAG, alloc_tag_node()); if (!obj->type) obj->type = OBJ_TAG; if (obj->type != OBJ_TAG) { - error("Object %s is a %s, not a tree", + error("Object %s is a %s, not a tag", sha1_to_hex(sha1), typename(obj->type)); return NULL; }