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

Function load_tree_from_commit_contents

commit.c:437–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435}
436
437static void load_tree_from_commit_contents(struct repository *r, struct commit *commit)
438{
439 enum object_type type;
440 size_t size;
441 char *buf;
442 const char *p;
443 struct object_id tree_oid;
444
445 buf = odb_read_object(r->objects, &commit->object.oid, &type, &size);
446 if (!buf)
447 return;
448
449 if (type == OBJ_COMMIT &&
450 skip_prefix(buf, "tree ", &p) &&
451 !parse_oid_hex_algop(p, &tree_oid, &p, r->hash_algo) &&
452 *p == '\n')
453 set_commit_tree(commit, lookup_tree(r, &tree_oid));
454
455 free(buf);
456}
457
458struct tree *repo_get_commit_tree(struct repository *r,
459 const struct commit *commit)

Callers 1

repo_get_commit_treeFunction · 0.85

Calls 3

odb_read_objectFunction · 0.85
lookup_treeFunction · 0.85
set_commit_treeFunction · 0.70

Tested by

no test coverage detected