MCPcopy Index your code
hub / github.com/git/git / parse_object_buffer

Function parse_object_buffer

object.c:261–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261struct object *parse_object_buffer(struct repository *r, const struct object_id *oid, enum object_type type, unsigned long size, void *buffer, int *eaten_p)
262{
263 struct object *obj;
264 *eaten_p = 0;
265
266 obj = NULL;
267 if (type == OBJ_BLOB) {
268 struct blob *blob = lookup_blob(r, oid);
269 if (blob) {
270 parse_blob_buffer(blob);
271 obj = &blob->object;
272 }
273 } else if (type == OBJ_TREE) {
274 struct tree *tree = lookup_tree(r, oid);
275 if (tree) {
276 obj = &tree->object;
277 if (!tree->buffer)
278 tree->object.parsed = 0;
279 if (!tree->object.parsed) {
280 if (parse_tree_buffer(tree, buffer, size))
281 return NULL;
282 *eaten_p = 1;
283 }
284 }
285 } else if (type == OBJ_COMMIT) {
286 struct commit *commit = lookup_commit(r, oid);
287 if (commit) {
288 if (parse_commit_buffer(r, commit, buffer, size, 1))
289 return NULL;
290 if (save_commit_buffer &&
291 !get_cached_commit_buffer(r, commit, NULL)) {
292 set_commit_buffer(r, commit, buffer, size);
293 *eaten_p = 1;
294 }
295 obj = &commit->object;
296 }
297 } else if (type == OBJ_TAG) {
298 struct tag *tag = lookup_tag(r, oid);
299 if (tag) {
300 if (parse_tag_buffer(r, tag, buffer, size))
301 return NULL;
302 obj = &tag->object;
303 }
304 } else {
305 warning(_("object %s has unknown type id %d"), oid_to_hex(oid), type);
306 obj = NULL;
307 }
308 return obj;
309}
310
311struct object *parse_object_or_die(struct repository *repo,
312 const struct object_id *oid,

Callers 8

get_or_parse_objectFunction · 0.85
parse_object_with_flagsFunction · 0.85
export_blobFunction · 0.85
sha1_objectFunction · 0.85
fsck_obj_bufferFunction · 0.85
fsck_looseFunction · 0.85
count_objectsFunction · 0.85
write_objectFunction · 0.85

Calls 12

lookup_blobFunction · 0.85
parse_blob_bufferFunction · 0.85
lookup_treeFunction · 0.85
parse_tree_bufferFunction · 0.85
lookup_commitFunction · 0.85
parse_commit_bufferFunction · 0.85
get_cached_commit_bufferFunction · 0.85
set_commit_bufferFunction · 0.85
lookup_tagFunction · 0.85
parse_tag_bufferFunction · 0.85
warningFunction · 0.85
oid_to_hexFunction · 0.85

Tested by

no test coverage detected