summaryrefslogtreecommitdiff
path: root/commit-graph.h
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2019-06-18 18:14:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-06-20 03:46:26 (GMT)
commit6c622f9f0bbb38a23341dc4294f56d0d909b3d50 (patch)
treed9e05c4508dfab644d1d897d548ad408bb352fc1 /commit-graph.h
parent144354b054c99b2231be6bae517eed5f8da55268 (diff)
downloadgit-6c622f9f0bbb38a23341dc4294f56d0d909b3d50.zip
git-6c622f9f0bbb38a23341dc4294f56d0d909b3d50.tar.gz
git-6c622f9f0bbb38a23341dc4294f56d0d909b3d50.tar.bz2
commit-graph: write commit-graph chains
Extend write_commit_graph() to write a commit-graph chain when given the COMMIT_GRAPH_SPLIT flag. This implementation is purposefully simplistic in how it creates a new chain. The commits not already in the chain are added to a new tip commit-graph file. Much of the logic around writing a graph-{hash}.graph file and updating the commit-graph-chain file is the same as the commit-graph file case. However, there are several places where we need to do some extra logic in the split case. Track the list of graph filenames before and after the planned write. This will be more important when we start merging graph files, but it also allows us to upgrade our commit-graph file to the appropriate graph-{hash}.graph file when we upgrade to a chain of commit-graphs. Note that we use the eighth byte of the commit-graph header to store the number of base graph files. This determines the length of the base graphs chunk. A subtle change of behavior with the new logic is that we do not write a commit-graph if we our commit list is empty. This extends to the typical case, which is reflected in t5318-commit-graph.sh. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.h')
-rw-r--r--commit-graph.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/commit-graph.h b/commit-graph.h
index 6e7d42c..c321834 100644
--- a/commit-graph.h
+++ b/commit-graph.h
@@ -47,6 +47,7 @@ struct commit_graph {
unsigned char num_chunks;
uint32_t num_commits;
struct object_id oid;
+ char *filename;
uint32_t num_commits_in_base;
struct commit_graph *base_graph;
@@ -71,6 +72,7 @@ int generation_numbers_enabled(struct repository *r);
#define COMMIT_GRAPH_APPEND (1 << 0)
#define COMMIT_GRAPH_PROGRESS (1 << 1)
+#define COMMIT_GRAPH_SPLIT (1 << 2)
/*
* The write_commit_graph* methods return zero on success