Re: [PATCH 1/2] builtin/repo: only parse objects as needed
- From
Kristofer Karlsson <krka@spotify.com>
- Date
- Nov 16, 2026, 09:02 UTC
- Message-ID
- <CAL71e4MKmEsP9xsZ7eg_LOFSCiwOjVU9H=rvOYkOFXV=3rMPxw@mail.gmail.com>
- In-Reply-To
- <avqk_DfxW1uKFXi7@pks.im>
On Mon, 16 Nov 2026 at 07:38, Patrick Steinhardt <ps@pks.im> wrote:
Show 14 quoted lines
> > On Fri, Nov 13, 2026 at 03:12:19PM +0100, Kristofer Karlsson wrote: > > On Fri, 13 Nov 2026 at 13:50, Patrick Steinhardt <ps@pks.im> wrote: > > > 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.
I think it would be a valid option, as long as their is enough test coverage. If there's ever a regression here that makes this function be called for commits that have not been loaded, the current implementation would mean surviving it, but at the cost of extra unintentional work, whereas a BUG() assert would make the regression more obvious.
It's not something I have a strong opinion on though, and I think the updated comment will make future developers see what the intention is.
Thanks, Kristofer