Elijah Newren | a64215b | 2023-02-24 00:09:30 +0000 | [diff] [blame] | 1 | #include "git-compat-util.h" |
Junio C Hamano | 8f1d2e6 | 2006-01-07 01:33:54 -0800 | [diff] [blame] | 2 | #include "blob.h" |
Stefan Beller | 68f95d3 | 2018-05-08 12:37:25 -0700 | [diff] [blame] | 3 | #include "repository.h" |
Stefan Beller | 14ba97f | 2018-05-15 14:48:42 -0700 | [diff] [blame] | 4 | #include "alloc.h" |
Daniel Barkalow | 175785e | 2005-04-18 11:39:48 -0700 | [diff] [blame] | 5 | |
| 6 | const char *blob_type = "blob"; |
| 7 | |
Stefan Beller | 17126cd | 2018-06-28 18:22:08 -0700 | [diff] [blame] | 8 | struct blob *lookup_blob(struct repository *r, const struct object_id *oid) |
Daniel Barkalow | 175785e | 2005-04-18 11:39:48 -0700 | [diff] [blame] | 9 | { |
Jeff King | d0229ab | 2019-06-20 03:41:14 -0400 | [diff] [blame] | 10 | struct object *obj = lookup_object(r, oid); |
Linus Torvalds | 100c5f3 | 2007-04-16 22:11:43 -0700 | [diff] [blame] | 11 | if (!obj) |
Jeff King | a378509 | 2019-06-20 03:41:21 -0400 | [diff] [blame] | 12 | return create_object(r, oid, alloc_blob_node(r)); |
Abhishek Kumar | 6da43d9 | 2020-06-17 14:44:08 +0530 | [diff] [blame] | 13 | return object_as_type(obj, OBJ_BLOB, 0); |
Daniel Barkalow | 175785e | 2005-04-18 11:39:48 -0700 | [diff] [blame] | 14 | } |
Daniel Barkalow | a510bfa | 2005-04-28 07:46:33 -0700 | [diff] [blame] | 15 | |
Jeff King | c1166ca | 2022-12-13 06:11:57 -0500 | [diff] [blame] | 16 | void parse_blob_buffer(struct blob *item) |
Nicolas Pitre | bd2c39f | 2005-05-06 13:48:34 -0400 | [diff] [blame] | 17 | { |
| 18 | item->object.parsed = 1; |
Nicolas Pitre | bd2c39f | 2005-05-06 13:48:34 -0400 | [diff] [blame] | 19 | } |