summaryrefslogtreecommitdiff
path: root/src/commit_graph.h
diff options
context:
space:
mode:
authorlhchavez <lhchavez@lhchavez.com>2020-02-17 21:28:13 +0000
committerlhchavez <lhchavez@lhchavez.com>2021-07-27 16:00:19 -0700
commit83862c83748b03d473a58d983916bec0bc385b62 (patch)
tree083ad1616ebdb7ff6c84a4afa7b1474899511d44 /src/commit_graph.h
parentf08cae109d9475a29209d444cf312388e7e64d83 (diff)
downloadlibgit2-83862c83748b03d473a58d983916bec0bc385b62.tar.gz
commit-graph: Add a way to write commit-graph files
This change adds the git_commit_graph_writer_* functions to allow to write and create `commit-graph` files from `.idx`/`.pack` files or `git_revwalk`s. Part of: #5757
Diffstat (limited to 'src/commit_graph.h')
-rw-r--r--src/commit_graph.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/commit_graph.h b/src/commit_graph.h
index e5e3ea1fd..9d0a827de 100644
--- a/src/commit_graph.h
+++ b/src/commit_graph.h
@@ -14,6 +14,7 @@
#include "git2/sys/commit_graph.h"
#include "map.h"
+#include "vector.h"
/**
* A commit-graph file.
@@ -119,6 +120,20 @@ int git_commit_graph_get_file(git_commit_graph_file **file_out, git_commit_graph
void git_commit_graph_refresh(git_commit_graph *cgraph);
/*
+ * A writer for `commit-graph` files.
+ */
+struct git_commit_graph_writer {
+ /*
+ * The path of the `objects/info` directory where the `commit-graph` will be
+ * stored.
+ */
+ git_buf objects_info_dir;
+
+ /* The list of packed commits. */
+ git_vector commits;
+};
+
+/*
* Returns whether the git_commit_graph_file needs to be reloaded since the
* contents of the commit-graph file have changed on disk.
*/