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

Function lookup_commit_in_graph

commit-graph.c:1023–1051  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1021}
1022
1023struct 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
1053static int parse_commit_in_graph_one(struct commit_graph *g,
1054 struct commit *item)

Callers 5

deref_without_lazy_fetchFunction · 0.85
parse_want_refFunction · 0.85
parse_object_with_flagsFunction · 0.85
store_updated_refsFunction · 0.85

Calls 6

git_env_boolFunction · 0.85
prepare_commit_graphFunction · 0.85
odb_has_objectFunction · 0.85
lookup_commitFunction · 0.85
fill_commit_in_graphFunction · 0.85

Tested by

no test coverage detected