Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Kristofer Karlsson <krka@spotify.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/2] builtin/repo: only parse objects as needed
Date: Mon, 16 Nov 2026 07:38:52 +0100	[thread overview]
Message-ID: <avqk_DfxW1uKFXi7@pks.im> (raw)
In-Reply-To: <CAL71e4NfnYLAXQT-wpb6ciJZwTrT51EZVsEs8VertN=xBmUD_g@mail.gmail.com>

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:
> >
> > +                       /*
> > +                        * 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.

> /*
> * 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

  reply	other threads:[~2026-11-16  6:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 11:46 [PATCH 0/2] builtin/repo: improve counting of objects Patrick Steinhardt
2026-11-13 11:46 ` [PATCH 1/2] builtin/repo: only parse objects as needed Patrick Steinhardt
2026-11-13 14:12   ` Kristofer Karlsson
2026-11-16  6:38     ` Patrick Steinhardt [this message]
2026-11-16  9:02       ` Kristofer Karlsson
2026-11-13 11:46 ` [PATCH 2/2] builtin/repo: don't fully parse trees Patrick Steinhardt
2026-11-13 14:15   ` Kristofer Karlsson
2026-11-16  6:39     ` Patrick Steinhardt
2026-11-16 13:43   ` Derrick Stolee
2026-11-16  8:01 ` [PATCH v2 0/2] builtin/repo: improve counting of objects Patrick Steinhardt
2026-11-16  8:01   ` [PATCH v2 1/2] builtin/repo: only parse objects as needed Patrick Steinhardt
2026-11-16  8:01   ` [PATCH v2 2/2] builtin/repo: don't fully parse trees Patrick Steinhardt
2026-11-16  9:07   ` [PATCH v2 0/2] builtin/repo: improve counting of objects Kristofer Karlsson
2026-11-16 16:02   ` Derrick Stolee
2026-11-16 17:32     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=avqk_DfxW1uKFXi7@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=krka@spotify.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox