blob: 888e28a5594747bd263df0bb8f2179122bccb131 [file] [log] [blame]
Elijah Newrena64215b2023-02-24 00:09:30 +00001#include "git-compat-util.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));
Abhishek Kumar6da43d92020-06-17 14:44:08 +053013 return object_as_type(obj, OBJ_BLOB, 0);
Daniel Barkalow175785e2005-04-18 11:39:48 -070014}
Daniel Barkalowa510bfa2005-04-28 07:46:33 -070015
Jeff Kingc1166ca2022-12-13 06:11:57 -050016void parse_blob_buffer(struct blob *item)
Nicolas Pitrebd2c39f2005-05-06 13:48:34 -040017{
18 item->object.parsed = 1;
Nicolas Pitrebd2c39f2005-05-06 13:48:34 -040019}