Re: [PATCH 1/2] builtin/repo: only parse objects as needed
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Nov 16, 2026, 06:38 UTC
- Message-ID
- <avqk_DfxW1uKFXi7@pks.im>
- In-Reply-To
- <CAL71e4NfnYLAXQT-wpb6ciJZwTrT51EZVsEs8VertN=xBmUD_g@mail.gmail.com>
On Fri, Nov 13, 2026 at 03:12:19PM +0100, Kristofer Karlsson wrote:
Show 17 quoted lines
> On Fri, 13 Nov 2026 at 13:50, Patrick Steinhardt <ps@pks.im> wrote: > > > > + /* > > + * Commits have already been parsed by the revision > > + * walk, so there is no need to read their contents > > + * again. > > + */ > > + commit = lookup_commit(data->odb->repo, &oids->oid[i]); > > + if (!commit || repo_parse_commit(data->odb->repo, commit)) > > + continue; > > Tiny nit: I understood the comment as saying that the code > depends on the commits being parsed already, but > repo_parse_commit() handles the case where they are not. > Since path-walk hands us commits from get_revision(), I > assume that is only a failsafe? So this is just about the > phrasing. How about:
Yeah, it is. I was wondering whether I want to call `BUG()` here in the case where the commit cannot be parsed, as that case really shouldn't ever happen. But that felt a bit heavy-handed to me.
Show 9 quoted lines
> /* > * Commits should already have been parsed by the > * revision walk, so we do not need to read their > * contents again. > */ > > Otherwise this looks good to me. Only reading contents for > trees avoids inflating every blob just to throw it away, which > is a nice easy win.
Yeah, that reads a bit better to me indeed. Will adapt, thanks!
Patrick