blob: 36f9abda19ec1095a903aa138bdf53ce18a86b10 [file] [log] [blame]
Daniel Barkalow175785e2005-04-18 11:39:48 -07001#include "cache.h"
Junio C Hamano8f1d2e62006-01-07 01:33:54 -08002#include "blob.h"
Stefan Beller68f95d32018-05-08 12:37:25 -07003#include "repository.h"
Stefan Beller14ba97f2018-05-15 14:48:42 -07004#include "alloc.h"
Daniel Barkalow175785e2005-04-18 11:39:48 -07005
6const char *blob_type = "blob";
7
Stefan Beller17126cd2018-06-28 18:22:08 -07008struct blob *lookup_blob(struct repository *r, const struct object_id *oid)
Daniel Barkalow175785e2005-04-18 11:39:48 -07009{
Jeff Kingd0229ab2019-06-20 03:41:14 -040010 struct object *obj = lookup_object(r, oid);
Linus Torvalds100c5f32007-04-16 22:11:43 -070011 if (!obj)
Jeff Kinga3785092019-06-20 03:41:21 -040012 return create_object(r, oid, alloc_blob_node(r));
Stefan Beller17126cd2018-06-28 18:22:08 -070013 return object_as_type(r, obj, OBJ_BLOB, 0);
Daniel Barkalow175785e2005-04-18 11:39:48 -070014}
Daniel Barkalowa510bfa2005-04-28 07:46:33 -070015
Nicolas Pitrebd2c39f2005-05-06 13:48:34 -040016int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size)
17{
18 item->object.parsed = 1;
19 return 0;
20}