🌐 AI搜索 & 代理 主页
blob: ae320bd8fa22aaaef8144bd6bc35c20d1e85e4f4 [file] [log] [blame]
Daniel Barkalow175785e2005-04-18 18:39:481#include "cache.h"
Junio C Hamano8f1d2e62006-01-07 09:33:542#include "blob.h"
Daniel Barkalow175785e2005-04-18 18:39:483
4const char *blob_type = "blob";
5
Jason McMullan5d6ccf52005-06-03 15:05:396struct blob *lookup_blob(const unsigned char *sha1)
Daniel Barkalow175785e2005-04-18 18:39:487{
8 struct object *obj = lookup_object(sha1);
Linus Torvalds100c5f32007-04-17 05:11:439 if (!obj)
10 return create_object(sha1, OBJ_BLOB, alloc_blob_node());
Nicolas Pitred1af0022005-05-20 20:59:1711 if (!obj->type)
Linus Torvalds19746322006-07-12 03:45:3112 obj->type = OBJ_BLOB;
13 if (obj->type != OBJ_BLOB) {
Linus Torvalds885a86a2006-06-14 23:45:1314 error("Object %s is a %s, not a blob",
15 sha1_to_hex(sha1), typename(obj->type));
Daniel Barkalow175785e2005-04-18 18:39:4816 return NULL;
17 }
18 return (struct blob *) obj;
19}
Daniel Barkalowa510bfa2005-04-28 14:46:3320
Nicolas Pitrebd2c39f2005-05-06 17:48:3421int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size)
22{
23 item->object.parsed = 1;
24 return 0;
25}