]> git.ipfire.org Git - thirdparty/git.git/commit
fetch-pack: wire up and enable auto filter logic
authorChristian Couder <christian.couder@gmail.com>
Tue, 23 Dec 2025 11:11:13 +0000 (12:11 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 23 Dec 2025 13:43:06 +0000 (22:43 +0900)
commitc01bcb5d0044607ccbbe9eafc100a2522e8afa03
tree68013158f1f35876977bade0a958a03bbc998501
parentd92ba46d5aaf86dc2a6591b47993c72fb46c0ee8
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 <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/fetch-options.adoc
Documentation/git-clone.adoc
Documentation/gitprotocol-v2.adoc
builtin/clone.c
builtin/fetch.c
fetch-pack.c
t/t5710-promisor-remote-capability.sh
transport.c