summaryrefslogtreecommitdiff
path: root/commit-graph.h
diff options
context:
space:
mode:
authorAbhishek Kumar <abhishekkumar8222@gmail.com>2021-01-16 18:11:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-01-19 00:21:18 (GMT)
commit72a2bfcaf01860ce8dd6921490d903dc0ad59c89 (patch)
tree6ee5e441f612736befa821e9121dc90b2446914b /commit-graph.h
parentc0ef139843a27f67a1e02c41944a16a736493351 (diff)
downloadgit-72a2bfcaf01860ce8dd6921490d903dc0ad59c89.zip
git-72a2bfcaf01860ce8dd6921490d903dc0ad59c89.tar.gz
git-72a2bfcaf01860ce8dd6921490d903dc0ad59c89.tar.bz2
commit-graph: add a slab to store topological levels
In a later commit we will introduce corrected commit date as the generation number v2. Corrected commit dates will be stored in the new seperate Generation Data chunk. However, to ensure backwards compatibility with "Old" Git we need to continue to write generation number v1 (topological levels) to the commit data chunk. Thus, we need to compute and store both versions of generation numbers to write the commit-graph file. Therefore, let's introduce a commit-slab `topo_level_slab` to store topological levels; corrected commit date will be stored in the member `generation` of struct commit_graph_data. The macros `GENERATION_NUMBER_INFINITY` and `GENERATION_NUMBER_ZERO` mark commits not in the commit-graph file and commits written by a version of Git that did not compute generation numbers respectively. Generation numbers are computed identically for both kinds of commits. A "slab-miss" should return `GENERATION_NUMBER_INFINITY` as the commit is not in the commit-graph file. However, since the slab is zero-initialized, it returns 0 (or rather `GENERATION_NUMBER_ZERO`). Thus, we no longer need to check if the topological level of a commit is `GENERATION_NUMBER_INFINITY`. We will add a pointer to the slab in `struct write_commit_graph_context` and `struct commit_graph` to populate the slab in `fill_commit_graph_info` if the commit has a pre-computed topological level as in case of split commit-graphs. Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com> Reviewed-by: Taylor Blau <me@ttaylorr.com> Reviewed-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.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/commit-graph.h b/commit-graph.h
index f8e9250..00f0074 100644
--- a/commit-graph.h
+++ b/commit-graph.h
@@ -73,6 +73,7 @@ struct commit_graph {
const unsigned char *chunk_bloom_indexes;
const unsigned char *chunk_bloom_data;
+ struct topo_level_slab *topo_levels;
struct bloom_filter_settings *bloom_filter_settings;
};