From: tboegi@web.de
To: git@vger.kernel.org, mh@glandium.org, gitster@pobox.com
Cc: "Torsten Bögershausen" <tboegi@web.de>
Subject: [PATCH v1 1/1] connect: [host:port] is lagacy for ssh
Date: Sun, 5 Jun 2016 13:09:53 +0200 [thread overview]
Message-ID: <1465124993-3379-1-git-send-email-tboegi@web.de> (raw)
In-Reply-To: <xmqqinxozzuj.fsf@gitster.mtv.corp.google.com>
From: Torsten Bögershausen <tboegi@web.de>
Early versions of the parser in connect.c handled
git clone [host:123]:/path the same as
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>
---
This is my attempt to keep the legacy for ssh only,
and fixes my comments
connect.c | 11 ++++-------
t/t5500-fetch-pack.sh | 17 +++++++++++++++++
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/connect.c b/connect.c
index 076ae09..9576d0f 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;
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index 2d9c4be..b7d21da 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -618,6 +618,23 @@ do
'
done
done
+ # git with scheme and []
+ for p in git
+ do
+ for h in [host:123]
+ do
+ for c in "" :
+ do
+ test_expect_success "fetch-pack --diag-url $p://$h$c/$r" '
+ check_prot_host_port_path $p://$h/$r $p "$h" NONE "/$r"
+ '
+ # "/~" -> "~" conversion
+ test_expect_success "fetch-pack --diag-url $p://$h$c/~$r" '
+ check_prot_host_port_path $p://$h/~$r $p "$h" NONE "~$r"
+ '
+ done
+ done
+ done
# file with scheme
for p in file
do
--
2.0.0.rc1.6318.g0c2c796
next prev parent reply other threads:[~2016-06-05 11:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-02 22:52 What's cooking in git.git (Jun 2016, #01; Thu, 2) Junio C Hamano
2016-06-02 23:13 ` Mike Hommey
2016-06-03 5:07 ` Torsten Bögershausen
2016-06-03 15:59 ` Junio C Hamano
2016-06-03 23:26 ` Mike Hommey
2016-06-03 23:47 ` Junio C Hamano
2016-06-04 5:14 ` Mike Hommey
2016-06-04 14:51 ` Torsten Bögershausen
2016-06-04 21:46 ` Mike Hommey
2016-06-04 16:24 ` Junio C Hamano
2016-06-05 9:29 ` Torsten Bögershausen
2016-06-05 11:09 ` tboegi [this message]
2016-06-05 18:56 ` [PATCH v1 1/1] connect: [host:port] is lagacy for ssh Eric Sunshine
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1465124993-3379-1-git-send-email-tboegi@web.de \
--to=tboegi@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mh@glandium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).