From aecd794fca275b42e271b80236e95f0d288bd709 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 14 Jun 2024 06:42:03 -0400 Subject: remote: drop checks for zero-url case Now that the previous commit removed the possibility that a "struct remote" will ever have zero url fields, we can drop a number of redundant checks and untriggerable code paths. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- transport.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'transport.c') diff --git a/transport.c b/transport.c index eba92eb7e0..a324045240 100644 --- a/transport.c +++ b/transport.c @@ -1112,6 +1112,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); @@ -1127,19 +1128,15 @@ struct transport *transport_get(struct remote *remote, const char *url) ret->remote = remote; helper = remote->foreign_vcs; - if (!url && remote->url.nr) + 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); -- cgit v1.3-5-g9baa