Merge branch 'bc/maint-fetch-url-only'
[git/jnareb-git.git] / blob.c
blobae320bd8fa22aaaef8144bd6bc35c20d1e85e4f4
1 #include "cache.h"
2 #include "blob.h"
4 const char *blob_type = "blob";
6 struct blob *lookup_blob(const unsigned char *sha1)
8 struct object *obj = lookup_object(sha1);
9 if (!obj)
10 return create_object(sha1, OBJ_BLOB, alloc_blob_node());
11 if (!obj->type)
12 obj->type = OBJ_BLOB;
13 if (obj->type != OBJ_BLOB) {
14 error("Object %s is a %s, not a blob",
15 sha1_to_hex(sha1), typename(obj->type));
16 return NULL;
18 return (struct blob *) obj;
21 int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size)
23 item->object.parsed = 1;
24 return 0;