alloc: allow arbitrary repositories for alloc functions
[git/git.git] / blob.c
CommitLineData
175785e5 1#include "cache.h"
8f1d2e6f 2#include "blob.h"
68f95d38 3#include "repository.h"
14ba97f8 4#include "alloc.h"
175785e5
DB
5
6const char *blob_type = "blob";
7
3aca1fc6 8struct blob *lookup_blob(const struct object_id *oid)
175785e5 9{
3aca1fc6 10 struct object *obj = lookup_object(oid->hash);
100c5f3b 11 if (!obj)
68f95d38 12 return create_object(the_repository, oid->hash,
f0de1d62 13 alloc_blob_node(the_repository));
8ff226a9 14 return object_as_type(obj, OBJ_BLOB, 0);
175785e5 15}
a510bfaa 16
bd2c39f5
NP
17int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size)
18{
19 item->object.parsed = 1;
20 return 0;
21}