Re: [PATCH v2 8/8] fetch-pack: wire up and enable auto filter logic
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Feb 12, 2026, 10:07 UTC
- Message-ID
- <CAP8UFD3jw0Lz_58ejfwyeE=VOhrZYq67495Gx+7fRKgzakDkkw@mail.gmail.com>
- In-Reply-To
- <aYxsmsQlbm4t2zLY@pks.im>
On Wed, Feb 11, 2026 at 12:48 PM Patrick Steinhardt <ps@pks.im> wrote:
Show 23 quoted lines
>
> On Wed, Feb 04, 2026 at 12:08:13PM +0100, Christian Couder wrote:
> > diff --git a/fetch-pack.c b/fetch-pack.c
> > index 40316c9a34..5e9a969e31 100644
> > --- a/fetch-pack.c
> > +++ b/fetch-pack.c
> > @@ -1661,6 +1662,33 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
> > struct string_list packfile_uris = STRING_LIST_INIT_DUP;
> > int i;
> > struct strvec index_pack_args = STRVEC_INIT;
> > + const char *promisor_remote_config;
> > +
> > + if (server_feature_v2("promisor-remote", &promisor_remote_config)) {
> > + char *remote_name = promisor_remote_reply(promisor_remote_config);
> > + free(remote_name);
> > + }
>
> Huh. Do we only call this function because it calls
> `filter_promisor_remote()`? We don't seem to care about anything else
> and do some more work to assemble the `remote_name` string that
> ultimately ends up being pointless.
>
> Maybe we should instead expose that function?Yeah, we could expose that function, but then we would discard the `struct strvec` that the function requires and populates, so the "huh" factor might in some way be even bigger.
I think it would be better to change the signature of promisor_remote_reply() to:
void promisor_remote_reply(const char *info, char **accepted)
This way we could pass NULL as the second argument and the function would not assemble a string in that case.
Show 10 quoted lines
> > + if (args->filter_options.choice == LOFC_AUTO) {
> > + struct strbuf errbuf = STRBUF_INIT;
> > + char *constructed_filter = promisor_remote_construct_filter(r);
> > +
> > + list_objects_filter_release(&args->filter_options);
> > + /* The result of resolving an 'auto' filter must not be 'auto' */
> > + args->filter_options.allow_auto_filter = 0;
>
> We didn't resolve though, we only released it. So the commend doesn't
> seem accurate to me anymore.What the comment wanted to say is that when we are going to resolve an auto filter, in gently_parse_list_objects_filter() below, the result must not be 'auto', so we disallow 'auto'.
So maybe something like /* Disallow 'auto' as a result of the resolution of this 'auto' filter below */ ?
Show 18 quoted lines
> > + if (constructed_filter)
> > + gently_parse_list_objects_filter(&args->filter_options,
> > + constructed_filter,
> > + &errbuf);
> > +
> > + if (errbuf.len > 0)
> > + die(_("couldn't resolve 'auto' filter '%s': %s"),
> > + constructed_filter, errbuf.buf);
>
> I think `gently_parse_list_objects_filter()` already returns non-zero in
> all failure cases, so shouldn't we rather:
>
> if (constructed_filter &&
> gently_parse_list_objects_filter(&args->filter_options,
> constructed_filter,
> &errbuf);
> die(_("couldn't resolve 'auto' filter '%s': %s"),
> constructed_filter, errbuf.buf);Yeah, it might be easier to understand. I will use your suggestion.
Thanks.