summaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorTorsten Bögershausen <tboegi@web.de>2016-06-05 13:09:53 +0200
committerJunio C Hamano <gitster@pobox.com>2016-06-06 11:01:39 -0700
commit052b49d560e9cd2f8bf9842437802ff2fab96556 (patch)
tree789bb5ce20775f6f518eee4a1c50abfbe7811076 /connect.c
parentf0e238651d25962ba89417c678aa12d932e437e7 (diff)
downloadgit-mh/connect.tar.gz
connect: [host:port] is legacy for sshmh/connect
Early versions of the parser in connect.c treated these two as the same: git clone [host:123]:/path git clone ssh://host:123/path Keep that feature as legacy, but disable it for all other protocols. Everything inside [] should go into the host part. Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/connect.c b/connect.c
index 076ae091a8..9576d0f511 100644
--- a/connect.c
+++ b/connect.c
@@ -618,10 +618,7 @@ static enum protocol parse_connect_url(const char *url_orig, char **ret_user,
}
}
- /*
- * Don't do destructive transforms as protocol code does
- * '[]' unwrapping in get_host_and_port()
- */
+ /* '[]' unwrapping is done in get_host_and_port() */
end = host_end(&host, 0);
if (protocol == PROTO_LOCAL)
@@ -670,10 +667,10 @@ static enum protocol parse_connect_url(const char *url_orig, char **ret_user,
/*
* get_host_and_port does not return a port in the [host:port]:path
* case. In that case, it is called with "[host:port]" and returns
- * "host:port" and NULL.
- * To support this undocumented legacy we still need to split the port.
+ * "host:port" and NULL. To support this undocumented legacy
+ * (for ssh only) we still need to split the port.
*/
- if (!port)
+ if (!port && protocol == PROTO_SSH)
port = get_port(host);
*ret_user = user ? xstrdup(user) : NULL;