@@ -40,32 +40,32 @@ Values 1-4 satisfy the requirements of parse_commit_gently().
4040
4141Define the "generation number" of a commit recursively as follows:
4242
43- * A commit with no parents (a root commit) has generation number one.
43+ * A commit with no parents (a root commit) has generation number one.
4444
45- * A commit with at least one parent has generation number one more than
46- the largest generation number among its parents.
45+ * A commit with at least one parent has generation number one more than
46+ the largest generation number among its parents.
4747
4848Equivalently, the generation number of a commit A is one more than the
4949length of a longest path from A to a root commit. The recursive definition
5050is easier to use for computation and observing the following property:
5151
52- If A and B are commits with generation numbers N and M, respectively,
53- and N <= M, then A cannot reach B. That is, we know without searching
54- that B is not an ancestor of A because it is further from a root commit
55- than A.
52+ If A and B are commits with generation numbers N and M, respectively,
53+ and N <= M, then A cannot reach B. That is, we know without searching
54+ that B is not an ancestor of A because it is further from a root commit
55+ than A.
5656
57- Conversely, when checking if A is an ancestor of B, then we only need
58- to walk commits until all commits on the walk boundary have generation
59- number at most N. If we walk commits using a priority queue seeded by
60- generation numbers, then we always expand the boundary commit with highest
61- generation number and can easily detect the stopping condition.
57+ Conversely, when checking if A is an ancestor of B, then we only need
58+ to walk commits until all commits on the walk boundary have generation
59+ number at most N. If we walk commits using a priority queue seeded by
60+ generation numbers, then we always expand the boundary commit with highest
61+ generation number and can easily detect the stopping condition.
6262
6363This property can be used to significantly reduce the time it takes to
6464walk commits and determine topological relationships. Without generation
6565numbers, the general heuristic is the following:
6666
67- If A and B are commits with commit time X and Y, respectively, and
68- X < Y, then A _probably_ cannot reach B.
67+ If A and B are commits with commit time X and Y, respectively, and
68+ X < Y, then A _probably_ cannot reach B.
6969
7070This heuristic is currently used whenever the computation is allowed to
7171violate topological relationships due to clock skew (such as "git log"
@@ -85,8 +85,11 @@ have generation number represented by the macro GENERATION_NUMBER_ZERO = 0.
8585Since the commit-graph file is closed under reachability, we can guarantee
8686the following weaker condition on all commits:
8787
88- If A and B are commits with generation numbers N amd M, respectively,
89- and N < M, then A cannot reach B.
88+ [quote]
89+ _____________________________________________________________________
90+ If A and B are commits with generation numbers N amd M, respectively,
91+ and N < M, then A cannot reach B.
92+ _____________________________________________________________________
9093
9194Note how the strict inequality differs from the inequality when we have
9295fully-computed generation numbers. Using strict inequality may result in
@@ -121,11 +124,8 @@ Future Work
121124- After computing and storing generation numbers, we must make graph
122125 walks aware of generation numbers to gain the performance benefits they
123126 enable. This will mostly be accomplished by swapping a commit-date-ordered
124- priority queue with one ordered by generation number. The following
125- operations are important candidates:
126-
127- - 'log --topo-order'
128- - 'tag --merged'
127+ priority queue with one ordered by generation number. Commands that could
128+ improve include 'git log --topo-order' and 'git tag --merged'.
129129
130130- A server could provide a commit graph file as part of the network protocol
131131 to avoid extra calculations by clients. This feature is only of benefit if
@@ -148,13 +148,16 @@ Related Links
148148 More discussion about generation numbers and not storing them inside
149149 commit objects. A valuable quote:
150150
151- "I think we should be moving more in the direction of keeping
152- repo-local caches for optimizations. Reachability bitmaps have been
153- a big performance win. I think we should be doing the same with our
154- properties of commits. Not just generation numbers, but making it
155- cheap to access the graph structure without zlib-inflating whole
156- commit objects (i.e., packv4 or something like the "metapacks" I
157- proposed a few years ago)."
151+ [quote, Jeff "Peff" King]
152+ ____________________________________________________________________
153+ I think we should be moving more in the direction of keeping
154+ repo-local caches for optimizations. Reachability bitmaps have been
155+ a big performance win. I think we should be doing the same with our
156+ properties of commits. Not just generation numbers, but making it
157+ cheap to access the graph structure without zlib-inflating whole
158+ commit objects (i.e., packv4 or something like the "metapacks" I
159+ proposed a few years ago).
160+ ____________________________________________________________________
158161
159162[4] https://public-inbox.org/git/20180108154822.54829-1-git@jeffhostetler.com/T/#u
160163 A patch to remove the ahead-behind calculation from 'status'.
0 commit comments