Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 3/3] connected: search promisor objects generically
Date: Wed, 24 Jun 2026 11:33:12 +0200	[thread overview]
Message-ID: <ajukWExVvpz8NFEc@pks.im> (raw)
In-Reply-To: <xmqq4iiu1mrt.fsf@gitster.g>

On Mon, Jun 22, 2026 at 10:57:10AM -0700, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
[snip]
> > -		 *
> > -		 * Before checking for promisor packs, be sure we have the
> > -		 * latest pack-files loaded into memory.
> >  		 */
> > -		odb_reprepare(the_repository->objects);
> 
> Hmph?

Oh, I think I completely misread this as `odb_alternates_prepare()`,
which is something you typically see before loops like this. By using a
helper like `odb_for_each_object_ext()` we of course wouldn't have to
call that function anymore.

But this here is of course different, as this call would also cause us
to reload packfiles and loose objects.

> >  		do {
> > -			struct packed_git *p;
> > -
> > -			repo_for_each_pack(the_repository, p) {
> > -				if (!p->pack_promisor)
> > -					continue;
> > -				if (find_pack_entry_one(oid, p))
> > -					goto promisor_pack_found;
> > +			opts.prefix = oid;
> > +
> > +			err = odb_for_each_object_ext(the_repository->objects,
> > +						      NULL, promised_object_cb,
> > +						      NULL, &opts);
> > +			if (err < 0)
> > +				break;
> > +			if (err > 0) {
> > +				err = 0;
> > +				continue;
> >  			}
> 
> So we used to manually iterate and stop when we have a matching pack
> entry, but now "stop when we find" is done by promisor_object_cb
> callback that returns 1.
> 
> What is the reason why we no longer odb_(re)prepare() upfront before
> going into the loop?  Would it make us miss a newly added promisor
> packs?  We will fall back to rev-list for correctness, so it may not
> matter, though.

So yes, this is a bug.

Thanks!

Patrick

  reply	other threads:[~2026-06-24  9:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-22  8:49 [PATCH 0/3] connected: search promisor objects generically Patrick Steinhardt
2026-06-22  8:49 ` [PATCH 1/3] odb/source-packed: extract logic to skip certain packs Patrick Steinhardt
2026-06-22 17:51   ` Junio C Hamano
2026-06-22  8:49 ` [PATCH 2/3] odb/source-packed: support flags when iterating an object prefix Patrick Steinhardt
2026-06-22  8:49 ` [PATCH 3/3] connected: search promisor objects generically Patrick Steinhardt
2026-06-22 17:57   ` Junio C Hamano
2026-06-24  9:33     ` Patrick Steinhardt [this message]
2026-06-23  7:45   ` Christian Couder
2026-06-24  9:33     ` Patrick Steinhardt
2026-06-24 10:37 ` [PATCH v2 0/4] " Patrick Steinhardt
2026-06-24 10:37   ` [PATCH v2 1/4] odb/source-packed: extract logic to skip certain packs Patrick Steinhardt
2026-06-24 10:37   ` [PATCH v2 2/4] odb/source-packed: support flags when iterating an object prefix Patrick Steinhardt
2026-06-24 17:02     ` Christian Couder
2026-06-24 10:37   ` [PATCH v2 3/4] connected: split out promisor-based connectivity check Patrick Steinhardt
2026-06-24 10:37   ` [PATCH v2 4/4] connected: search promisor objects generically Patrick Steinhardt
2026-06-24 16:27     ` 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=ajukWExVvpz8NFEc@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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