]> git.ipfire.org Git - thirdparty/git.git/commit
promisor-remote: keep advertised filter in memory
authorChristian Couder <christian.couder@gmail.com>
Tue, 23 Dec 2025 11:11:12 +0000 (12:11 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 23 Dec 2025 13:43:06 +0000 (22:43 +0900)
commitd92ba46d5aaf86dc2a6591b47993c72fb46c0ee8
treef149ea7cc92fade4003bb2bf674529ee0e919ff8
parentc8c941181aaacd2d3b40a092e7c5e8d01919a86d
promisor-remote: keep advertised filter in memory

Currently, advertised filters are only kept in memory temporarily
during parsing, or persisted to disk if `promisor.storeFields`
contains 'partialCloneFilter'.

In a following commit though, we will add a `--filter=auto` option.
This option will enable the client to use the filters that the server
is suggesting for the promisor remotes the client accepts.

To use them even if `promisor.storeFields` is not configured, these
filters should be stored somewhere for the current session.

Let's add an `advertised_filter` field to `struct promisor_remote`
for that purpose.

To ensure that the filters are available in all cases,
filter_promisor_remote() captures them into a temporary list and
applies them to the `promisor_remote` structs after the potential
configuration reload.

Then the accepted remotes are marked as `accepted` in the repository
state. This ensures that subsequent calls to look up accepted remotes
(like in the filter construction below) actually find them.

In a following commit, we will add a `--filter=auto` option that will
enable a client to use the filters suggested by the server for the
promisor remotes the client accepted.

To enable the client to construct a filter spec based on these filters,
let's add a `promisor_remote_construct_filter(repo)` function.

This function:

- iterates over all accepted promisor remotes in the repository,
- collects the filters advertised for them (using `advertised_filter`
  which a previous commit added to `struct promisor_remote`), and
- generates a single filter spec for them (using the
  `list_objects_filter_combine()` function added by a previous commit).

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
promisor-remote.c
promisor-remote.h