diff options
author | Derrick Stolee <dstolee@microsoft.com> | 2019-06-18 20:14:24 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-06-20 05:46:25 +0200 |
commit | d4f4d60f6da8b93f768b2b4958c04cc1b3cea443 (patch) | |
tree | 1f88453dc1b3ff7d3e126b2288c9ae7076b360e3 /commit-graph.h | |
parent | commit-graph: document commit-graph chains (diff) | |
download | git-d4f4d60f6da8b93f768b2b4958c04cc1b3cea443.tar.xz git-d4f4d60f6da8b93f768b2b4958c04cc1b3cea443.zip |
commit-graph: prepare for commit-graph chains
To prepare for a chain of commit-graph files, augment the
commit_graph struct to point to a base commit_graph. As we load
commits from the graph, we may actually want to read from a base
file according to the graph position.
The "graph position" of a commit is given by concatenating the
lexicographic commit orders from each of the commit-graph files in
the chain. This means that we must distinguish two values:
* lexicographic index : the position within the lexicographic
order in a single commit-graph file.
* graph position: the position within the concatenated order
of multiple commit-graph files
Given the lexicographic index of a commit in a graph, we can
compute the graph position by adding the number of commits in
the lower-level graphs. To find the lexicographic index of
a commit, we subtract the number of commits in lower-level graphs.
While here, change insert_parent_or_die() to take a uint32_t
position, as that is the type used by its only caller and that
makes more sense with the limits in the commit-graph format.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rw-r--r-- | commit-graph.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/commit-graph.h b/commit-graph.h index 390c7f6961..5819910a5b 100644 --- a/commit-graph.h +++ b/commit-graph.h @@ -48,6 +48,9 @@ struct commit_graph { uint32_t num_commits; struct object_id oid; + uint32_t num_commits_in_base; + struct commit_graph *base_graph; + const uint32_t *chunk_oid_fanout; const unsigned char *chunk_oid_lookup; const unsigned char *chunk_commit_data; |