| 1021 | } |
| 1022 | |
| 1023 | struct commit *lookup_commit_in_graph(struct repository *repo, const struct object_id *id) |
| 1024 | { |
| 1025 | static int commit_graph_paranoia = -1; |
| 1026 | struct commit_graph *g; |
| 1027 | struct commit *commit; |
| 1028 | uint32_t pos; |
| 1029 | |
| 1030 | if (commit_graph_paranoia == -1) |
| 1031 | commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 0); |
| 1032 | |
| 1033 | g = prepare_commit_graph(repo); |
| 1034 | if (!g) |
| 1035 | return NULL; |
| 1036 | if (!search_commit_pos_in_graph(id, g, &pos)) |
| 1037 | return NULL; |
| 1038 | if (commit_graph_paranoia && !odb_has_object(repo->objects, id, 0)) |
| 1039 | return NULL; |
| 1040 | |
| 1041 | commit = lookup_commit(repo, id); |
| 1042 | if (!commit) |
| 1043 | return NULL; |
| 1044 | if (commit->object.parsed) |
| 1045 | return commit; |
| 1046 | |
| 1047 | if (!fill_commit_in_graph(commit, g, pos)) |
| 1048 | return NULL; |
| 1049 | |
| 1050 | return commit; |
| 1051 | } |
| 1052 | |
| 1053 | static int parse_commit_in_graph_one(struct commit_graph *g, |
| 1054 | struct commit *item) |
no test coverage detected