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

Function prepare_commit_graph

commit-graph.c:738–779  ·  view source on GitHub ↗

* Return 1 if commit_graph is non-NULL, and 0 otherwise. * * On the first invocation, this function attempts to load the commit * graph if the repository is configured to have one. */

Source from the content-addressed store, hash-verified

736 * graph if the repository is configured to have one.
737 */
738static struct commit_graph *prepare_commit_graph(struct repository *r)
739{
740 struct odb_source *source;
741
742 /*
743 * Early return if there is no object database or if the commit graph is
744 * disabled.
745 *
746 * This must come before the "already attempted?" check below, because
747 * we want to disable even an already-loaded graph file.
748 */
749 if (!r->objects || r->commit_graph_disabled)
750 return NULL;
751
752 if (r->objects->commit_graph_attempted)
753 return r->objects->commit_graph;
754 r->objects->commit_graph_attempted = 1;
755
756 prepare_repo_settings(r);
757
758 if (!git_env_bool(GIT_TEST_COMMIT_GRAPH, 0) &&
759 r->settings.core_commit_graph != 1)
760 /*
761 * This repository is not configured to use commit graphs, so
762 * do not load one. (But report commit_graph_attempted anyway
763 * so that commit graph loading is not attempted again for this
764 * repository.)
765 */
766 return NULL;
767
768 if (!commit_graph_compatible(r))
769 return NULL;
770
771 odb_prepare_alternates(r->objects);
772 for (source = r->objects->sources; source; source = source->next) {
773 r->objects->commit_graph = read_commit_graph_one(source);
774 if (r->objects->commit_graph)
775 break;
776 }
777
778 return r->objects->commit_graph;
779}
780
781int generation_numbers_enabled(struct repository *r)
782{

Callers 7

lookup_commit_in_graphFunction · 0.85
parse_commit_in_graphFunction · 0.85
write_commit_graphFunction · 0.85

Calls 5

prepare_repo_settingsFunction · 0.85
git_env_boolFunction · 0.85
commit_graph_compatibleFunction · 0.85
odb_prepare_alternatesFunction · 0.85
read_commit_graph_oneFunction · 0.85

Tested by

no test coverage detected