On Tue, 3 Apr 2018 12:51:39 -0400 Derrick Stolee <dstolee@xxxxxxxxxxxxx> wrote: > The generation number of a commit is defined recursively as follows: > > * If a commit A has no parents, then the generation number of A is one. > * If a commit A has parents, then the generation number of A is one > more than the maximum generation number among the parents of A. > > Add a uint32_t generation field to struct commit so we can pass this > information to revision walks. We use two special values to signal > the generation number is invalid: > > GENERATION_NUMBER_UNDEF 0xFFFFFFFF > GENERATION_NUMBER_NONE 0 > > The first (_UNDEF) means the generation number has not been loaded or > computed. The second (_NONE) means the generation number was loaded > from a commit graph file that was stored before generation numbers > were computed. > > Signed-off-by: Derrick Stolee <dstolee@xxxxxxxxxxxxx> This looks straightforward and correct, thanks. I think some of the description above should appear as code comments. > +#define GENERATION_NUMBER_UNDEF 0xFFFFFFFF > +#define GENERATION_NUMBER_NONE 0 I would include the description above here as documentation, and would replace "was stored before generation numbers were computed" by "was written by a version of Git that did not support generation numbers".