From: Patrick Steinhardt Date: Thu, 03 Dec 2026 13:18:18 GMT Subject: Re: [PATCH v2 2/7] commit-graph: simplify linking commit graph chains Message-ID: In-Reply-To: On Thu, Dec 03, 2026 at 03:33:09PM +0530, Kaartic Sivaraam wrote: > On 11/20/26 17:52, Patrick Steinhardt wrote: > > When we load a commit graph chain we verify for every layer that the > > hash of the base commit graph matches what the current tip has in its > > base graphs chunk. To do so we pass both the chain itself as well as the > > array of object IDs that we have read from the commit-graph chain file > > to `add_graph_to_chain()`. > > > > But the array of object IDs is redundant information: we have already > > loaded and linked the base layers, and as part of that we have stored > > their respective hashes in the structure itself. Consequently, we can > > already derive the hashes by walking the chain of base layers. > > > The hashes stored in the structure are the layers' trailers, not the hashes > from the chain file. They only agree because the previous patch now compares > each layer's trailer with the chain file right after loading it. Since this > function becomes public so that the backend can call it, could the comment > in the header say that it validates `g` against the trailers of `base`, and > that callers are expected to have verified those against the chain file > themselves? Fair, this is a bit stale now. I'll reword this a bit: But the array of object IDs is redundant information: starting with the preceding commit we already verify that the hash of the layer matches the hash in the chain file. And consequently, we can derive the hashes by walking the chain of base layers. Patrick