| 435 | } |
| 436 | |
| 437 | static 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 | |
| 458 | struct tree *repo_get_commit_tree(struct repository *r, |
| 459 | const struct commit *commit) |
no test coverage detected