From ef2f1845ec4b683df791bfd956f551b096a38009 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Mon, 16 Feb 2026 14:23:15 +0100 Subject: fetch-pack: wire up and enable auto filter logic Previous commits have set up an infrastructure for `--filter=auto` to automatically prepare a partial clone filter based on what the server advertised and the client accepted. Using that infrastructure, let's now enable the `--filter=auto` option in `git clone` and `git fetch` by setting `allow_auto_filter` to 1. Note that these small changes mean that when `git clone --filter=auto` or `git fetch --filter=auto` are used, "auto" is automatically saved as the partial clone filter for the server on the client. Therefore subsequent calls to `git fetch` on the client will automatically use this "auto" mode even without `--filter=auto`. Let's also set `allow_auto_filter` to 1 in `transport.c`, as the transport layer must be able to accept the "auto" filter spec even if the invoking command hasn't fully parsed it yet. When an "auto" filter is requested, let's have the "fetch-pack.c" code in `do_fetch_pack_v2()` compute a filter and send it to the server. In `do_fetch_pack_v2()` the logic also needs to check for the "promisor-remote" capability and call `promisor_remote_reply()` to parse advertised remotes and populate the list of those accepted (and their filters). Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- builtin/clone.c | 2 ++ builtin/fetch.c | 2 ++ 2 files changed, 4 insertions(+) (limited to 'builtin') diff --git a/builtin/clone.c b/builtin/clone.c index bb27472020..45d8fa0eed 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -1001,6 +1001,8 @@ int cmd_clone(int argc, NULL }; + filter_options.allow_auto_filter = 1; + packet_trace_identity("clone"); repo_config(the_repository, git_clone_config, NULL); diff --git a/builtin/fetch.c b/builtin/fetch.c index 8fbf3557ce..573c295241 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -2580,6 +2580,8 @@ int cmd_fetch(int argc, OPT_END() }; + filter_options.allow_auto_filter = 1; + packet_trace_identity("fetch"); /* Record the command line for the reflog */ -- cgit v1.3-6-g1900