| 456 | } |
| 457 | |
| 458 | struct tree *repo_get_commit_tree(struct repository *r, |
| 459 | const struct commit *commit) |
| 460 | { |
| 461 | if (commit->maybe_tree || !commit->object.parsed) |
| 462 | return commit->maybe_tree; |
| 463 | |
| 464 | if (commit_graph_position(commit) != COMMIT_NOT_FROM_GRAPH) |
| 465 | return get_commit_tree_in_graph(r, commit); |
| 466 | |
| 467 | /* |
| 468 | * This is either a corrupt commit, or one which we partially loaded |
| 469 | * from a graph file but then subsequently threw away the graph data. |
| 470 | * |
| 471 | * Optimistically assume it's the latter and try to reload from |
| 472 | * scratch. This gives a performance penalty if it really is a corrupt |
| 473 | * commit, but presumably that happens rarely (and only once per |
| 474 | * process). |
| 475 | */ |
| 476 | load_tree_from_commit_contents(r, (struct commit *)commit); |
| 477 | return commit->maybe_tree; |
| 478 | } |
| 479 | |
| 480 | struct object_id *get_commit_tree_oid(const struct commit *commit) |
| 481 | { |
no test coverage detected