diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-07-02 18:59:01 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-07-02 18:59:01 +0200 |
commit | ca463101c8978910c45d9a053dc1af07d42a8664 (patch) | |
tree | 66e0f54a02bf160b2476427202f9cbc3e92527e2 /transport.c | |
parent | Merge branch 'jc/fuzz-sans-curl' (diff) | |
parent | remote: drop checks for zero-url case (diff) | |
download | git-ca463101c8978910c45d9a053dc1af07d42a8664.tar.xz git-ca463101c8978910c45d9a053dc1af07d42a8664.zip |
Merge branch 'jk/remote-wo-url'
Memory ownership rules for the in-core representation of
remote.*.url configuration values have been straightened out, which
resulted in a few leak fixes and code clarification.
* jk/remote-wo-url:
remote: drop checks for zero-url case
remote: always require at least one url in a remote
t5801: test remote.*.vcs config
t5801: make remote-testgit GIT_DIR setup more robust
remote: allow resetting url list
config: document remote.*.url/pushurl interaction
remote: simplify url/pushurl selection
remote: use strvecs to store remote url/pushurl
remote: transfer ownership of memory in add_url(), etc
remote: refactor alias_url() memory ownership
archive: fix check for missing url
Diffstat (limited to 'transport.c')
-rw-r--r-- | transport.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/transport.c b/transport.c index b9c8827ed9..139721a990 100644 --- a/transport.c +++ b/transport.c @@ -1114,6 +1114,7 @@ static struct transport_vtable builtin_smart_vtable = { struct transport *transport_get(struct remote *remote, const char *url) { const char *helper; + const char *p; struct transport *ret = xcalloc(1, sizeof(*ret)); ret->progress = isatty(2); @@ -1129,19 +1130,15 @@ struct transport *transport_get(struct remote *remote, const char *url) ret->remote = remote; helper = remote->foreign_vcs; - if (!url && remote->url) - url = remote->url[0]; + if (!url) + url = remote->url.v[0]; ret->url = url; - /* maybe it is a foreign URL? */ - if (url) { - const char *p = url; - - while (is_urlschemechar(p == url, *p)) - p++; - if (starts_with(p, "::")) - helper = xstrndup(url, p - url); - } + p = url; + while (is_urlschemechar(p == url, *p)) + p++; + if (starts_with(p, "::")) + helper = xstrndup(url, p - url); if (helper) { transport_helper_init(ret, helper); |