Re: [PATCH 2/9] fsck_tree(): fix shadowed variable
- From
Jeff King <peff@peff.net>
- Date
- May 3, 2021, 20:13 UTC
- Message-ID
- <YJBZYt8ivlTDHpRM@coredump.intra.peff.net>
- In-Reply-To
- <87y2cwvz9e.fsf@evledraar.gmail.com>
On Mon, May 03, 2021 at 01:15:03PM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 9 quoted lines
> > Commit b2f2039c2b (fsck: accept an oid instead of a "struct tree" for > > fsck_tree(), 2019-10-18) introduced a new "oid" parameter to > > fsck_tree(), and we pass it to the report() function when we find > [...] > > Have you considered just passing down the "obj" instead of the "oid"? > It's a bit of a bigger change, but seems to be worth it in this case as > the below diff (on top of master) shows. We spend quite a bit of effort > peeling an "obj" just to pass oid/type further down the stack.
That would be undoing the point of the referenced commit above. More discussion in this thread:
https://lore.kernel.org/git/20191018044103.GA17625@sigill.intra.peff.net/
but the gist is:
- there were bugs caused by looking at the object structs; not having
it make sure we can't introduce similar bugs - using oids and buffers makes it possible for code to avoid having
object structs at all. index-pack could take advantage of this (to
reduce memory usage), but nobody has yet written that patch.-Peff