From: david@lang.hm Date: Thu, 21 Jul 2011 04:26:43 GMT Subject: Re: Git commit generation numbers Message-ID: In-Reply-To: On Wed, 20 Jul 2011, Shawn Pearce wrote: > On Wed, Jul 20, 2011 at 17:18, wrote: >> >> if it's just locally generated, then I could easily see generation numbers >> being different on different people's ssstems, dependin on the order that >> they see commits (either locally generated or pulled from others) > > But this should only happen if the user fudges with their Git sources > and makes Git produce a different generation number. > > If the algorithm is always "gen(A) = max(gen(P) for each parent_of(A)) > + 1" then it doesn't matter who merged what commits, the same commit > appears at the same part of the graph relative to all of its > ancestors, and therefore always has the same generation number. This > is true whether or not the commit contains the generation number. I have to think about this more, but I'm wondering about cases where the same result ia achieved via different methods, something along the lines of one person developing something with _many_ commits (creating a large generation number) that one person merges far sooner than another, causing the commits that they do after the merge to have much larger generation numbers than someone making the same changes, but doing the merge later something like C9 \ C2 - C10 - C11 - C12 vs C9 \ C2 - C3 - C4 - C5 - C10 where the C10-12 in the first set and C3-5 in the second set are completely unrelated to what's done in C9 and C12 in the first set and C10 in the sedond set are identical trees. now I know that part of a commit is what it's parents are, so that is different (and that may be enough to say that generations don't matter and this entire issue is moot), but I haven't thought about it long enough to convince myself what would (or should) happen in these cases. David Lang >> If it's part of the commit, then as that commit gets propogated the >> generation number gets propogated as well, and every repository will agree >> on what the generation number is for any commit that's shared. > > This isn't really as beneficial as you are making it out to be. We > already can agree on what the generation number should be for any > given commit, if you topo-sort the commit DAG, you get the same > result. > >> I agree that this consistancy guarantee seems to be valuable. > > Its valuable, but its consistent either with a cache, or not. > >