git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/3] connected: search promisor objects generically

From
Patrick Steinhardt <ps@pks.im>
Date
Jun 24, 2026, 09:33 UTC
Message-ID
<ajukWExVvpz8NFEc@pks.im>
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]
Show 7 quoted lines
> > -		 *
> > -		 * 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.

Show 28 quoted lines
> >  		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
Previous: Junio C HamanoNext: Christian Couder
Message 7 of 25 in “connected: search promisor objects generically”
  1. 0/3 connected: search promisor objects genericallyPatrick Steinhardt, Jun 22, 2026
  2. 1/3 odb/source-packed: extract logic to skip certain packsPatrick Steinhardt, Jun 22, 2026
  3. Junio C HamanoJun 22, 2026
  4. 2/3 odb/source-packed: support flags when iterating an object prefixPatrick Steinhardt, Jun 22, 2026
  5. 3/3 connected: search promisor objects genericallyPatrick Steinhardt, Jun 22, 2026
  6. Junio C HamanoJun 22, 2026
  7. Patrick SteinhardtJun 24, 2026
  8. Christian CouderJun 23, 2026
  9. Patrick SteinhardtJun 24, 2026
  10. 0/4 connected: search promisor objects genericallyPatrick Steinhardt, Jun 24, 2026
  11. 1/4 odb/source-packed: extract logic to skip certain packsPatrick Steinhardt, Jun 24, 2026
  12. 2/4 odb/source-packed: support flags when iterating an object prefixPatrick Steinhardt, Jun 24, 2026
  13. Christian CouderJun 24, 2026
  14. Patrick SteinhardtJun 25, 2026
  15. 3/4 connected: split out promisor-based connectivity checkPatrick Steinhardt, Jun 24, 2026
  16. 4/4 connected: search promisor objects genericallyPatrick Steinhardt, Jun 24, 2026
  17. Junio C HamanoJun 24, 2026
  18. Patrick SteinhardtJun 25, 2026
  19. 0/4 connected: search promisor objects genericallyPatrick Steinhardt, Jun 25, 2026
  20. 1/4 odb/source-packed: extract logic to skip certain packsPatrick Steinhardt, Jun 25, 2026
  21. 2/4 odb/source-packed: support flags when iterating an object prefixPatrick Steinhardt, Jun 25, 2026
  22. 3/4 connected: split out promisor-based connectivity checkPatrick Steinhardt, Jun 25, 2026
  23. 4/4 connected: search promisor objects genericallyPatrick Steinhardt, Jun 25, 2026
  24. Junio C HamanoJun 25, 2026
  25. Christian CouderJun 26, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.