Re: [RFC][GSoC] Implement Generation Number v2
- From
Abhishek Kumar <abhishekkumar8222@gmail.com>
- Date
- Mar 23, 2020, 11:32 UTC
- Message-ID
- <20200323113231.GA22065@Abhishek-Arch>
- In-Reply-To
- <xmqq369z7i1b.fsf@gitster.c.googlers.com>
On Sun, Mar 22, 2020 at 10:32:32PM -0700, Junio C Hamano wrote:
Show 24 quoted lines
> Abhishek Kumar <abhishekkumar8222@gmail.com> writes: > > >> Unfortunately for the time being we cannot use commit-graph format > >> version; the idea that was proposed on the mailing list (when we found > >> about the bug in handling commit-graph versioning, during incremental > >> commit-graph implementation), was to create and use metadata chunk or > >> versioning chunk (the final version of incremental format do not use > >> this mechanism). This could be used by gen2 compatibile Git to > >> distinguish between situation where old commit-graph file to be updated > >> uses generation number v1, and when it uses v2. > >> > >> If you have a better idea, please say so. > > > > We could also use a flag file. Here's how it works: > > > > If the file `.git/info/generation-number-v2` exists, use gen2. > > Otherwise use gen1. > > If the file is lost then we will try to read the other file that has > the commit-graph data as if it were in old format? And if such a > file was created (say, with "touch .git/info/generation-number-v2"), > a file in the original format will be read as if it is in new > format? If that is the case, it is likely that we'd see a segfault; > sounds too brittle to me.
Agreed. Flag file has too many issues to be pursued further.
Show 8 quoted lines
> > It appears that the format of "CDAT", and the fact that generation > is represented as higher 30-bit of a be32 integer, is very much > hardcoded in the design and is hard to change, but your new version > of graph file can be designed not to use "CDAT" chunk at all, and > instead have the commit data with new version of generation numbers > stored in a different chunk (say "CDA2") to force older version of > Git not to use the new graph file---would that work?
A commit-graph without "CDAT" chunk will hard fail on older versions of Git. verify_commit_graph_lite() errors out if chunk_commit_data is null.
Metadata chunk seems the way to go.
Regards Abhishek