Skip to content

Commit 1472978

Browse files
derrickstoleegitster
authored andcommitted
commit-graph.txt: update design document
We now calculate generation numbers in the commit-graph file and use them in paint_down_to_common(). Expand the section on generation numbers to discuss how the three special generation numbers GENERATION_NUMBER_INFINITY, _ZERO, and _MAX interact with other generation numbers. Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7adf526 commit 1472978

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

Documentation/technical/commit-graph.txt

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,29 @@ in the commit graph. We can treat these commits as having "infinite"
7777
generation number and walk until reaching commits with known generation
7878
number.
7979

80+
We use the macro GENERATION_NUMBER_INFINITY = 0xFFFFFFFF to mark commits not
81+
in the commit-graph file. If a commit-graph file was written by a version
82+
of Git that did not compute generation numbers, then those commits will
83+
have generation number represented by the macro GENERATION_NUMBER_ZERO = 0.
84+
85+
Since the commit-graph file is closed under reachability, we can guarantee
86+
the following weaker condition on all commits:
87+
88+
If A and B are commits with generation numbers N amd M, respectively,
89+
and N < M, then A cannot reach B.
90+
91+
Note how the strict inequality differs from the inequality when we have
92+
fully-computed generation numbers. Using strict inequality may result in
93+
walking a few extra commits, but the simplicity in dealing with commits
94+
with generation number *_INFINITY or *_ZERO is valuable.
95+
96+
We use the macro GENERATION_NUMBER_MAX = 0x3FFFFFFF to for commits whose
97+
generation numbers are computed to be at least this value. We limit at
98+
this value since it is the largest value that can be stored in the
99+
commit-graph file using the 30 bits available to generation numbers. This
100+
presents another case where a commit can have generation number equal to
101+
that of a parent.
102+
80103
Design Details
81104
--------------
82105

@@ -98,18 +121,14 @@ Future Work
98121
- The 'commit-graph' subcommand does not have a "verify" mode that is
99122
necessary for integration with fsck.
100123

101-
- The file format includes room for precomputed generation numbers. These
102-
are not currently computed, so all generation numbers will be marked as
103-
0 (or "uncomputed"). A later patch will include this calculation.
104-
105124
- After computing and storing generation numbers, we must make graph
106125
walks aware of generation numbers to gain the performance benefits they
107126
enable. This will mostly be accomplished by swapping a commit-date-ordered
108127
priority queue with one ordered by generation number. The following
109128
operations are important candidates:
110129

111-
- paint_down_to_common()
112130
- 'log --topo-order'
131+
- 'tag --merged'
113132

114133
- Currently, parse_commit_gently() requires filling in the root tree
115134
object for a commit. This passes through lookup_tree() and consequently

0 commit comments

Comments
 (0)