From: Christian Couder Date: Tue, 19 May 2026 15:25:25 GMT Subject: Re: [PATCH v2 7/8] promisor-remote: auto-configure unknown remotes Message-ID: In-Reply-To: <87v7cunlid.fsf@toon--20250203-5JQV3.mail-host-address-is-not-set> On Mon, May 11, 2026 at 3:06 PM Toon Claes wrote: > > +static char *promisor_remote_name_from_url(const char *url) > > +{ > > + struct url_info url_info = { 0 }; > > + char *normalized = url_normalize(url, &url_info); > > + struct strbuf buf = STRBUF_INIT; > > + > > + if (!normalized) { > > + warning(_("couldn't normalize advertised url '%s', " > > + "ignoring this remote"), url); > > + return NULL; > > + } > > + > > + if (url_info.host_len) { > > + strbuf_add(&buf, normalized + url_info.host_off, url_info.host_len); > > + strbuf_addch(&buf, '-'); > > + } > > + > > + if (url_info.port_len) { > > + strbuf_add(&buf, normalized + url_info.port_off, url_info.port_len); > > + strbuf_addch(&buf, '-'); > > If the url doesn't have a path, this could lead to the name being > `example-com-8443`. But we have a MAX_REMOTES_WITH_SIMILAR_NAMES at 20, > would this be an issue for a second remote without configured name? > > As far as I can tell from handle_matching_allowed_url(), it's no issue, > because the numeric `-%d` suffix is added and we never atoi() the number > from existing remotes in the config. Right. [...] > > +test_expect_success "clone with URL allowlisted and no remote already configured" ' > > + git -C server config promisor.advertise true && > > + test_when_finished "rm -rf client" && > > + test_when_finished "rm -f full_names" && > > + > > + GIT_NO_LAZY_FETCH=0 git clone \ > > + -c promisor.acceptfromserver=None \ > > + -c promisor.acceptFromServerUrl="$ENCODED_TRASH_DIRECTORY_URL/*" \ > > + --no-local --filter="blob:limit=5k" server client && > > So promisor.acceptFromServerUrl only works if promisor.acceptFromServer > is "none"? I mean which one should precedence? If > promisor.acceptFromServer is set to "all", the promisor remote is > accepted by the client, but not saved to the config. Is that > intentional? Should we document that? Yeah, it was buggy in v2 for some values of `promisor.acceptfromserver`, and things were not properly documented. But I think it's correct and much clearer now in v3 as discussed in my reply to your comments on the previous patch. Thanks.