summaryrefslogtreecommitdiff
path: root/fuzzers
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 /fuzzers
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 'fuzzers')
-rw-r--r--fuzzers/commit_graph_fuzzer.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fuzzers/commit_graph_fuzzer.c b/fuzzers/commit_graph_fuzzer.c
index eb2c38258..b41816ed9 100644
--- a/fuzzers/commit_graph_fuzzer.c
+++ b/fuzzers/commit_graph_fuzzer.c
@@ -31,7 +31,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv)
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
- git_commit_graph_file cgraph = {{0}};
+ git_commit_graph_file file = {{0}};
git_commit_graph_entry e;
git_buf commit_graph_buf = GIT_BUF_INIT;
git_oid oid = {{0}};
@@ -62,19 +62,19 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
git_buf_attach_notowned(&commit_graph_buf, (char *)data, size);
}
- if (git_commit_graph_parse(
- &cgraph,
+ if (git_commit_graph_file_parse(
+ &file,
(const unsigned char *)git_buf_cstr(&commit_graph_buf),
git_buf_len(&commit_graph_buf))
< 0)
goto cleanup;
/* Search for any oid, just to exercise that codepath. */
- if (git_commit_graph_entry_find(&e, &cgraph, &oid, GIT_OID_HEXSZ) < 0)
+ if (git_commit_graph_entry_find(&e, &file, &oid, GIT_OID_HEXSZ) < 0)
goto cleanup;
cleanup:
- git_commit_graph_close(&cgraph);
+ git_commit_graph_file_close(&file);
git_buf_dispose(&commit_graph_buf);
return 0;
}