add object_as_type helper for casting objects
[git/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 9 if (!obj)
d36f51c1 10 return create_object(sha1, alloc_blob_node());
8ff226a9 11 return object_as_type(obj, OBJ_BLOB, 0);
175785e5 12}
a510bfaa 13
bd2c39f5
NP
14int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size)
15{
16 item->object.parsed = 1;
17 return 0;
18}