From: Patrick Steinhardt Date: Thu, 25 Jun 2026 05:52:14 GMT Subject: Re: [PATCH v2 2/4] odb/source-packed: support flags when iterating an object prefix Message-ID: In-Reply-To: On Wed, Jun 24, 2026 at 07:02:48PM +0200, Christian Couder wrote: > On Wed, Jun 24, 2026 at 12:37 PM Patrick Steinhardt wrote: > > diff --git a/odb/source-packed.c b/odb/source-packed.c > > index 3afc4bf01f..6f31f0ff94 100644 > > --- a/odb/source-packed.c > > +++ b/odb/source-packed.c > > @@ -171,6 +172,20 @@ static int for_each_prefixed_object_in_midx( > > const struct object_id *current = NULL; > > struct object_id oid; > > > > + if (opts->flags) { > > + uint32_t pack_id = nth_midxed_pack_int_id(m, i); > > + struct packed_git *pack; > > + > > + if (prepare_midx_pack(m, pack_id)) { > > + pack_errors = true; > > + continue; > > + } > > + > > + pack = nth_midxed_pack(m, pack_id); > > + if (should_exclude_pack(pack, opts->flags)) > > + continue; > > + } > > + > > current = nth_midxed_object_oid(&oid, m, i); > > > > if (!match_hash(len, opts->prefix->hash, current->hash)) > > It looks like this is: > > if (!match_hash(len, opts->prefix->hash, current->hash)) > break; > > and I wonder if the `if (opts->flags) { ... }` block would be better > after that prefix check rather than before it. > > Putting it after the prefix check would make sure we don't continue > when the prefix doesn't match. Hm, that's a good point indeed. Will adapt, thanks! Patrick