Thread (108 messages) 108 messages, 7 authors, 20d ago

Re: [PATCH v2 8/8] fetch-pack: wire up and enable auto filter logic

From: Patrick Steinhardt <hidden>
Date: 2026-02-11 11:48:48

On Wed, Feb 04, 2026 at 12:08:13PM +0100, Christian Couder wrote:
quoted hunk ↗ jump to hunk
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?
+	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.
+		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);

Patrick
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help