Subject: [PATCH v6 3/4] commit-graph: export prepare_commit_graph()

From: Toon Claes <[email-masked]>
Date: Wed, 30 Jul 2025 19:55:09 +0200

Allow users of the commit-graph to explicitly prepare the commit-graph.
This can be useful when users want to start using bloom keys before
calling functions like prepare_revision_walk(). We'll use this exported
function in a subsequent commit.

Signed-off-by: Toon Claes <[email-masked]>
---
 commit-graph.c | 8 +-------
 commit-graph.h | 8 ++++++++
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/commit-graph.c b/commit-graph.c
index bd7b6f5338..a1f9fc22a4 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -739,13 +739,7 @@ static void prepare_commit_graph_one(struct repository *r,
 	r->objects->commit_graph = read_commit_graph_one(r, source);
 }
 
-/*
- * 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.
- */
-static int prepare_commit_graph(struct repository *r)
+int prepare_commit_graph(struct repository *r)
 {
 	struct odb_source *source;
 
diff --git a/commit-graph.h b/commit-graph.h
index 78ab7b875b..0f76681333 100644
--- a/commit-graph.h
+++ b/commit-graph.h
@@ -131,6 +131,14 @@ struct repo_settings;
 struct commit_graph *parse_commit_graph(struct repo_settings *s,
 					void *graph_map, size_t graph_size);
 
+/*
+ * 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.
+ */
+int prepare_commit_graph(struct repository *r);
+
 /*
  * Return 1 if and only if the repository has a commit-graph
  * file and generation numbers are computed in that file.
-- 
2.50.1.327.g047016eb4a