Re: [PATCH v2 1/7] commit-graph: verify all trailer hashes against the chain file
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Dec 3, 2026, 07:31 UTC
- Message-ID
- <axEay2CYz6zboLz0@pks.im>
- In-Reply-To
- <axCNrruYPAUVlUpC@denethor>
On Wed, Dec 02, 2026 at 04:29:11PM -0600, Justin Tobler wrote:
Show 24 quoted lines
> On 26/11/20 01:22PM, Patrick Steinhardt wrote: > > @@ -341,6 +342,32 @@ test_expect_success 'warn on base graph chunk incorrect' ' > > ) > > ' > > > > +test_expect_success 'tip layer trailer must match chain file' ' > > + git clone --no-hardlinks . tip-trailer && > > + ( > > + cd tip-trailer && > > + test_line_count = 2 $graphdir/commit-graph-chain && > > + tip_file=$graphdir/graph-$(tail -n 1 $graphdir/commit-graph-chain).graph && > > + corrupt_trailer "$tip_file" && > > + git -c core.commitGraph=false log >expect && > > + git -c core.commitGraph=true log >actual 2>err && > > + test_cmp expect actual && > > + test_grep "commit-graph chain does not match" err > > + ) > > +' > > With this test we corrupt the trailer of the tip layer and check that is > was indeed validated. Previously it would have been ignored. The base > layer should still be loaded and used though, but we don't really check > explicitly which layers were kept. Not sure it there is a good way to do > that anyway though.
Not that I'd know of, at least. `test-tool read-graph` gives us some info, but it doesn't give us the ability to figure out which layers have been loaded. Now we could of course extend it to give us that info, but I'm not sure that's worth it for a single test.
Hmm. That being said, the test-tool works somewhat funny in that it seems to only give information about the uppermost layer. So we can assert that initially it covers less commits, and then when we corrupt the uppermost layer it covers more commits because it uses the base layer now.
I'll adapt the test a bit.
Patrick