summaryrefslogtreecommitdiff
path: root/blob.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-07-22 10:59:24 -0700
committerJunio C Hamano <gitster@pobox.com>2014-07-22 10:59:25 -0700
commit10b944b37b11d6e0597541efdd1fa23c0eecbeff (patch)
tree2cbd3d48b1f08edee38c565984aaccdca325ef43 /blob.c
parent9f2de9c121c60cba9e55db5263a7bceffcd8fe2d (diff)
parentfa96082617e07d988103854fb96c5e92b7587e72 (diff)
downloadgit-10b944b37b11d6e0597541efdd1fa23c0eecbeff.tar.gz
Merge branch 'jk/alloc-commit-id'
Make sure all in-core commit objects are assigned a unique number so that they can be annotated using the commit-slab API. * jk/alloc-commit-id: 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 'blob.c')
-rw-r--r--blob.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/blob.c b/blob.c
index ae320bd8fa..1fcb8e44b0 100644
--- a/blob.c
+++ b/blob.c
@@ -7,15 +7,8 @@ struct blob *lookup_blob(const unsigned char *sha1)
{
struct object *obj = lookup_object(sha1);
if (!obj)
- return create_object(sha1, OBJ_BLOB, alloc_blob_node());
- if (!obj->type)
- obj->type = OBJ_BLOB;
- if (obj->type != OBJ_BLOB) {
- error("Object %s is a %s, not a blob",
- sha1_to_hex(sha1), typename(obj->type));
- return NULL;
- }
- return (struct blob *) obj;
+ return create_object(sha1, alloc_blob_node());
+ return object_as_type(obj, OBJ_BLOB, 0);
}
int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size)