On Wed, Apr 11, 2018 at 6:02 AM, Derrick Stolee <stolee@xxxxxxxxx> wrote: > On 4/10/2018 10:51 PM, Junio C Hamano wrote: >> >> Derrick Stolee <dstolee@xxxxxxxxxxxxx> writes: >> >>> + if ((*list)->generation != GENERATION_NUMBER_INFINITY) { >>> + if ((*list)->generation > GENERATION_NUMBER_MAX) >>> + die("generation number %u is too large to >>> store in commit-graph", >>> + (*list)->generation); >>> + packedDate[0] |= htonl((*list)->generation << 2); >>> + } >> >> >> How serious do we want this feature to be? On one extreme, we could >> be irresponsible and say it will be a problem for our descendants in >> the future if their repositories have more than billion pearls on a >> single strand, and the above certainly is a reasonable way to punt. >> Those who actually encounter the problem will notice by Git dying >> somewhere rather deep in the callchain. >> >> Or we could say Git actually does support a history that is >> arbitrarily long, even though such a deep portion of history will >> not benefit from having generation numbers in commit-graph. >> >> I've been assuming that our stance is the latter and that is why I >> made noises about overflowing 30-bit generation field in my review >> of the previous step. >> >> In case we want to do the "we know this is very large, but we do not >> know the exact value", we may actually want a mode where we can >> pretend that GENERATION_NUMBER_MAX is set to quite low (say 256) and >> make sure that the code to handle overflow behaves sensibly. > > > I agree. I wonder how we can effectively expose this value into a test. It's > probably not sufficient to manually test using compiler flags ("-D > GENERATION_NUMBER_MAX=8"). Would using an environment variable for this testing purpose be a good idea? If we allow a user to pass in an arbitrary maximum, then we'd have to care about generation numbers that are stored in the commit graph file larger than that user specific maximum, though. Looking through the output of "git grep getenv" we only have two instances with _DEBUG, both in transport.