summaryrefslogtreecommitdiff
path: root/src/commit_list.c
diff options
context:
space:
mode:
authorlhchavez <lhchavez@lhchavez.com>2021-03-10 07:06:15 -0800
committerlhchavez <lhchavez@lhchavez.com>2021-03-10 07:09:47 -0800
commit25b75cd9bc01896a2b74c748ceef7110ea1b165f (patch)
tree7f0adda00ff69e2a597dbcb0118ab737e47ec0fe /src/commit_list.c
parent248606ebb0906076367fcfce9574f522f818c26f (diff)
downloadlibgit2-25b75cd9bc01896a2b74c748ceef7110ea1b165f.tar.gz
commit-graph: Create `git_commit_graph` as an abstraction for the file
This change does a medium-size refactor of the git_commit_graph_file and the interaction with the ODB. Now instead of the ODB owning a direct reference to the git_commit_graph_file, there will be an intermediate git_commit_graph. The main advantage of that is that now end users can explicitly set a git_commit_graph that is eagerly checked for errors, while still being able to lazily use the commit-graph in a regular ODB, if the file is present.
Diffstat (limited to 'src/commit_list.c')
-rw-r--r--src/commit_list.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/commit_list.c b/src/commit_list.c
index dfdd5daab..11cc2e7d2 100644
--- a/src/commit_list.c
+++ b/src/commit_list.c
@@ -144,18 +144,18 @@ static int commit_quick_parse(
int git_commit_list_parse(git_revwalk *walk, git_commit_list_node *commit)
{
git_odb_object *obj;
- git_commit_graph_file *cgraph = NULL;
+ git_commit_graph_file *cgraph_file = NULL;
int error;
if (commit->parsed)
return 0;
/* Let's try to use the commit graph first. */
- git_odb__get_commit_graph(&cgraph, walk->odb);
- if (cgraph) {
+ git_odb__get_commit_graph_file(&cgraph_file, walk->odb);
+ if (cgraph_file) {
git_commit_graph_entry e;
- error = git_commit_graph_entry_find(&e, cgraph, &commit->oid, GIT_OID_RAWSZ);
+ error = git_commit_graph_entry_find(&e, cgraph_file, &commit->oid, GIT_OID_RAWSZ);
if (error == 0 && git__is_uint16(e.parent_count)) {
size_t i;
commit->generation = (uint32_t)e.generation;
@@ -166,7 +166,7 @@ int git_commit_list_parse(git_revwalk *walk, git_commit_list_node *commit)
for (i = 0; i < commit->out_degree; ++i) {
git_commit_graph_entry parent;
- error = git_commit_graph_entry_parent(&parent, cgraph, &e, i);
+ error = git_commit_graph_entry_parent(&parent, cgraph_file, &e, i);
if (error < 0)
return error;
commit->parents[i] = git_revwalk__commit_lookup(walk, &parent.sha1);