diff options
author | lhchavez <lhchavez@lhchavez.com> | 2021-01-04 18:22:43 -0800 |
---|---|---|
committer | lhchavez <lhchavez@lhchavez.com> | 2021-01-10 11:18:38 -0800 |
commit | 3fd57a75e9dd0c4b0e40ee6e21568d40bd70d29b (patch) | |
tree | 7ba89ed7cea693a3a48c6ab509608ab5175aab76 /tests/graph/commit_graph.c | |
parent | f0d7922c9bafff38e12978625f467aafebe75145 (diff) | |
download | libgit2-3fd57a75e9dd0c4b0e40ee6e21568d40bd70d29b.tar.gz |
commit-graph: Introduce a parser for commit-graph files
This change is the first in a series to add support for git's
commit-graph. This should speed up commit graph traversals by avoiding
object parsing and allowing some operations to terminate earlier.
Part of: #5757
Diffstat (limited to 'tests/graph/commit_graph.c')
-rw-r--r-- | tests/graph/commit_graph.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/graph/commit_graph.c b/tests/graph/commit_graph.c new file mode 100644 index 000000000..329aa5b00 --- /dev/null +++ b/tests/graph/commit_graph.c @@ -0,0 +1,20 @@ +#include "clar_libgit2.h" + +#include <git2.h> + +#include "commit_graph.h" + +void test_graph_commit_graph__parse(void) +{ + git_repository *repo; + struct git_commit_graph_file *cgraph; + git_buf commit_graph_path = GIT_BUF_INIT; + + cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git"))); + cl_git_pass(git_buf_joinpath(&commit_graph_path, git_repository_path(repo), "objects/info/commit-graph")); + cl_git_pass(git_commit_graph_open(&cgraph, git_buf_cstr(&commit_graph_path))); + + git_commit_graph_free(cgraph); + git_repository_free(repo); + git_buf_dispose(&commit_graph_path); +} |