@@ -49,23 +49,23 @@ Equivalently, the generation number of a commit A is one more than the
49
49
length of a longest path from A to a root commit. The recursive definition
50
50
is easier to use for computation and observing the following property:
51
51
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.
56
56
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.
62
62
63
63
This property can be used to significantly reduce the time it takes to
64
64
walk commits and determine topological relationships. Without generation
65
65
numbers, the general heuristic is the following:
66
66
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.
69
69
70
70
This heuristic is currently used whenever the computation is allowed to
71
71
violate topological relationships due to clock skew (such as "git log"
@@ -121,11 +121,8 @@ Future Work
121
121
- After computing and storing generation numbers, we must make graph
122
122
walks aware of generation numbers to gain the performance benefits they
123
123
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'
124
+ priority queue with one ordered by generation number. Commands that could
125
+ improve include 'git log --topo-order' and 'git tag --merged'.
129
126
130
127
- A server could provide a commit graph file as part of the network protocol
131
128
to avoid extra calculations by clients. This feature is only of benefit if
@@ -148,13 +145,13 @@ Related Links
148
145
More discussion about generation numbers and not storing them inside
149
146
commit objects. A valuable quote:
150
147
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)."
148
+ "I think we should be moving more in the direction of keeping
149
+ repo-local caches for optimizations. Reachability bitmaps have been
150
+ a big performance win. I think we should be doing the same with our
151
+ properties of commits. Not just generation numbers, but making it
152
+ cheap to access the graph structure without zlib-inflating whole
153
+ commit objects (i.e., packv4 or something like the "metapacks" I
154
+ proposed a few years ago)."
158
155
159
156
[4] https://public-inbox.org/git/
[email protected] /T/#u
160
157
A patch to remove the ahead-behind calculation from 'status'.
0 commit comments