diff options
| author | Christian Couder <christian.couder@gmail.com> | 2026-04-07 13:52:35 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-04-07 08:45:43 -0700 |
| commit | 720b7c26c82ef212852897bedb0d38eee78cb531 (patch) | |
| tree | 650379dcf3b8e70acc505dfda0ced1d120655361 /contrib/persistent-https | |
| parent | 8808e61fd3e953c3534633b8b5adc5b243dd696f (diff) | |
| download | git-720b7c26c82ef212852897bedb0d38eee78cb531.tar.gz git-720b7c26c82ef212852897bedb0d38eee78cb531.zip | |
promisor-remote: pass config entry to all_fields_match() directly
The `in_list == 0` path of all_fields_match() looks up the remote in
`config_info` by `advertised->name` repeatedly, even though every
caller in should_accept_remote() has already performed this
lookup and holds the result in `p`.
To avoid this useless work, let's replace the `int in_list`
parameter with a `struct promisor_info *config_entry` pointer:
- When NULL (ACCEPT_ALL mode): scan the whole `config_info` list, as
the old `in_list == 1` path did.
- When non-NULL: match against that single config entry directly,
avoiding the redundant string_list_lookup() call.
This removes the hidden dependency on `advertised->name` inside
all_fields_match(), which would be wrong if in the future
auto-configured remotes are implemented, as the local config name may
differ from the server's advertised name.
While at it, let's also add a comment before all_fields_match() and
match_field_against_config() to help understand how things work and
help avoid similar issues.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/persistent-https')
0 files changed, 0 insertions, 0 deletions
