Subject: Re: [PATCH 13/16] promisor-remote: introduce promisor.acceptFromServerUrl

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 26 Mar 2026 13:21:33 +0100

On Mon, Mar 23, 2026 at 09:05:16AM +0100, Christian Couder wrote:
> diff --git a/promisor-remote.c b/promisor-remote.c
> index c2f0eb7223..4cb18e1a6a 100644
> --- a/promisor-remote.c
> +++ b/promisor-remote.c
[snip]
> +static struct string_list *accept_from_server_url(struct repository *repo)
> +{
> +	static struct string_list accept_urls = STRING_LIST_INIT_DUP;
> +	static int initialized;
> +	const struct string_list *config_urls;
> +
> +	if (initialized)
> +		return &accept_urls;
> +
> +	initialized = 1;
> +
> +	if (!repo_config_get_string_multi(repo, "promisor.acceptfromserverurl", &config_urls)) {
> +		struct string_list_item *item;
> +
> +		for_each_string_list_item(item, config_urls) {
> +			struct allowed_url *allowed = valid_accept_url(item->string);
> +			if (allowed) {
> +				struct string_list_item *new;
> +				new = string_list_append(&accept_urls, item->string);
> +				new->util = allowed;
> +			}
> +		}
> +	}
> +
> +	return &accept_urls;
> +}

I'm still not much of a fan of us getting more and more function-local
static variables. It just feels wrong to me, and like we're accruing
technical debt. I also doubt that the performance overhead of storing
this on the stack with proper lifecycle management will matter at all
given that we're in a context where we talk with a remote anyway. The
handful of allocations really shouldn't matter in that context.

Patrick