diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2018-07-12 00:42:42 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-07-18 00:47:48 +0200 |
commit | dade47c06cf849b0ca180a8e6383b55ea6f75812 (patch) | |
tree | 9e7884a642dbf92f13b874457bf21464c383b9b2 /commit.c | |
parent | commit-graph: store graph in struct object_store (diff) | |
download | git-dade47c06cf849b0ca180a8e6383b55ea6f75812.tar.xz git-dade47c06cf849b0ca180a8e6383b55ea6f75812.zip |
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 <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
-rw-r--r-- | commit.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -342,7 +342,7 @@ struct tree *get_commit_tree(const struct commit *commit) if (commit->graph_pos == COMMIT_NOT_FROM_GRAPH) BUG("commit has NULL tree, but was not loaded from commit-graph"); - return get_commit_tree_in_graph(commit); + return get_commit_tree_in_graph(the_repository, commit); } struct object_id *get_commit_tree_oid(const struct commit *commit) @@ -438,7 +438,7 @@ int parse_commit_buffer(struct repository *r, struct commit *item, const void *b item->date = parse_commit_date(bufptr, tail); if (check_graph) - load_commit_graph_info(item); + load_commit_graph_info(the_repository, item); return 0; } @@ -454,7 +454,7 @@ int parse_commit_internal(struct commit *item, int quiet_on_missing, int use_com return -1; if (item->object.parsed) return 0; - if (use_commit_graph && parse_commit_in_graph(item)) + if (use_commit_graph && parse_commit_in_graph(the_repository, item)) return 0; buffer = read_object_file(&item->object.oid, &type, &size); if (!buffer) |