aboutsummaryrefslogtreecommitdiff
path: root/tag.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-07-28 10:35:35 -0700
committerJunio C Hamano <gitster@pobox.com>2014-07-28 10:35:35 -0700
commit5d7c37a130833d8e612f6b83f017ffe51a1a6833 (patch)
tree6ca634eb0048e97f868992642169b9e1cd99f387 /tag.c
parent740c281d21ef5b27f6f1b942a4f2fc20f51e8c7e (diff)
parentb794ebeac9151af4a9136ef28a22a06c2afb17cc (diff)
downloadgit-5d7c37a130833d8e612f6b83f017ffe51a1a6833.tar.gz
git-5d7c37a130833d8e612f6b83f017ffe51a1a6833.tar.xz
Merge branch 'jk/alloc-commit-id-maint' into maint
* jk/alloc-commit-id-maint: diff-tree: avoid lookup_unknown_object object_as_type: set commit index alloc: factor out commit index add object_as_type helper for casting objects parse_object_buffer: do not set object type move setting of object->type to alloc_* functions alloc: write out allocator definitions alloc.c: remove the alloc_raw_commit_node() function
Diffstat (limited to 'tag.c')
-rw-r--r--tag.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/tag.c b/tag.c
index 7b07921b3..82d841bf2 100644
--- a/tag.c
+++ b/tag.c
@@ -40,15 +40,8 @@ struct tag *lookup_tag(const unsigned char *sha1)
{
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 tag",
- sha1_to_hex(sha1), typename(obj->type));
- return NULL;
- }
- return (struct tag *) obj;
+ return create_object(sha1, alloc_tag_node());
+ return object_as_type(obj, OBJ_TAG, 0);
}
static unsigned long parse_tag_date(const char *buf, const char *tail)