]> Kevux Git Server - rit/commit
promisor-remote: keep advertised filters in memory
authorChristian Couder <christian.couder@gmail.com>
Mon, 16 Feb 2026 13:23:13 +0000 (14:23 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 17 Feb 2026 19:46:41 +0000 (11:46 -0800)
commit257f2db5d3e6d734861890ed4f1d81607f1702fe
tree56e383bec3beb06c4be9b2482e43449c38ec71bd
parentcd1a89838ad6753830afeed4ad8319e567b6e43d
promisor-remote: keep advertised filters 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 also 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`
  added in this commit, and
- generates a single filter spec for them.

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