Re: [PATCH] fsck: avoid looking at NULL blob->object
- From
Jeff King <peff@peff.net>
- Date
- Jun 9, 2018, 09:20 UTC
- Message-ID
- <20180609092056.GB6817@sigill.intra.peff.net>
- In-Reply-To
- <CACsJy8Cpd_0CR9F_xyQfcw0j8ceOf777KcWXLHuxY1NxmRnXqw@mail.gmail.com>
On Sat, Jun 09, 2018 at 10:45:15AM +0200, Duy Nguyen wrote:
Show 8 quoted lines
> > It seems like we could refactor report() to just take the > > object_id itself. But we pass the object pointer along to > > a callback function, and indeed this ends up in > > builtin/fsck.c's objreport() which does want to look at > > other parts of the object (like the type). > > And objreport() can handle OBJ_NONE well, which is the type given by > lookup_unknown_object(). So yeah this looks good.
Actually, we know that we have some "real" type, because otherwise lookup_blob() would not have returned NULL. In fact, we could actually use lookup_object() here to find that object, knowing that it exists in the hash. But IMHO that would be depending too much on how lookup_blob() works. :)
-Peff