path: root/commit-graph.h
diff options
authorJonathan Tan <>2018-07-11 22:42:42 (GMT)
committerJunio C Hamano <>2018-07-17 22:47:48 (GMT)
commitdade47c06cf849b0ca180a8e6383b55ea6f75812 (patch)
tree9e7884a642dbf92f13b874457bf21464c383b9b2 /commit-graph.h
parent8527750626f8a1b0fe641a5163760be054cc1d64 (diff)
commit-graph: add repo arg to graph readers
Add a struct repository argument to the functions in commit-graph.h that read the commit graph. (This commit does not affect functions that write commit graphs.) Because the commit graph functions can now read the commit graph of any repository, the global variable core_commit_graph has been removed. Instead, the config option core.commitGraph is now read on the first time in a repository that a commit is attempted to be parsed using its commit graph. This commit includes a test that exercises the functionality on an arbitrary repository that is not the_repository. Signed-off-by: Jonathan Tan <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'commit-graph.h')
1 files changed, 4 insertions, 3 deletions
diff --git a/commit-graph.h b/commit-graph.h
index 94defb0..76e0989 100644
--- a/commit-graph.h
+++ b/commit-graph.h
@@ -19,7 +19,7 @@ char *get_commit_graph_filename(const char *obj_dir);
* See parse_commit_buffer() for the fallback after this call.
-int parse_commit_in_graph(struct commit *item);
+int parse_commit_in_graph(struct repository *r, struct commit *item);
* It is possible that we loaded commit contents from the commit buffer,
@@ -27,9 +27,10 @@ int parse_commit_in_graph(struct commit *item);
* checked and filled. Fill the graph_pos and generation members of
* the given commit.
-void load_commit_graph_info(struct commit *item);
+void load_commit_graph_info(struct repository *r, struct commit *item);
-struct tree *get_commit_tree_in_graph(const struct commit *c);
+struct tree *get_commit_tree_in_graph(struct repository *r,
+ const struct commit *c);
struct commit_graph {
int graph_fd;