mirror of
https://github.com/libgit2/libgit2.git
synced 2026-01-25 02:56:17 +00:00
commit-graph: Support lookups of entries in a commit-graph
This change introduces `git_commit_graph_entry_find()` and `git_commit_graph_entry_parent()`. These two functions allow a much faster lookup of commits by ID, since the ODB does not need to be consulted, the commit object does not need to be inflated, and the contents of the commit object do not need to be parsed. Part of: #5757
This commit is contained in:
@@ -32,6 +32,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_entry e;
|
||||
git_buf commit_graph_buf = GIT_BUF_INIT;
|
||||
git_oid oid = {{0}};
|
||||
bool append_hash = false;
|
||||
@@ -68,6 +69,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
< 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)
|
||||
goto cleanup;
|
||||
|
||||
cleanup:
|
||||
git_commit_graph_close(&cgraph);
|
||||
git_buf_dispose(&commit_graph_buf);
|
||||
|
||||
Reference in New Issue
Block a user