]> git.ipfire.org Git - thirdparty/git.git/blame - blob.c
Documentation/git-archive: spell --worktree-attributes correctly
[thirdparty/git.git] / blob.c
CommitLineData
175785e5 1#include "cache.h"
8f1d2e6f 2#include "blob.h"
175785e5
DB
3
4const char *blob_type = "blob";
5
5d6ccf5c 6struct blob *lookup_blob(const unsigned char *sha1)
175785e5
DB
7{
8 struct object *obj = lookup_object(sha1);
100c5f3b
LT
9 if (!obj)
10 return create_object(sha1, OBJ_BLOB, alloc_blob_node());
d1af002d 11 if (!obj->type)
1974632c
LT
12 obj->type = OBJ_BLOB;
13 if (obj->type != OBJ_BLOB) {
885a86ab
LT
14 error("Object %s is a %s, not a blob",
15 sha1_to_hex(sha1), typename(obj->type));
175785e5
DB
16 return NULL;
17 }
18 return (struct blob *) obj;
19}
a510bfaa 20
bd2c39f5
NP
21int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size)
22{
23 item->object.parsed = 1;
24 return 0;
25}