summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-04-27 19:23:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-04-27 19:23:54 (GMT)
commitad34ad614da30387c82a54c7087705050b4de441 (patch)
tree998a6766aec9e4b9076a5a48c3f2fb64a1d2bdb4
parent89ba311df399d27a962b273e1acd95a38af2c821 (diff)
parent6b6c5f7a2f66751a93afce54277a1f30ab0dc521 (diff)
downloadgit-ad34ad614da30387c82a54c7087705050b4de441.zip
git-ad34ad614da30387c82a54c7087705050b4de441.tar.gz
git-ad34ad614da30387c82a54c7087705050b4de441.tar.bz2
Merge branch 'tb/connect-ipv6-parse-fix' into maint
An earlier update to the parser that disects a URL broke an address, followed by a colon, followed by an empty string (instead of the port number), e.g. ssh://example.com:/path/to/repo. * tb/connect-ipv6-parse-fix: connect.c: ignore extra colon after hostname
-rw-r--r--connect.c2
-rwxr-xr-xt/t5500-fetch-pack.sh17
-rwxr-xr-xt/t5601-clone.sh21
3 files changed, 24 insertions, 16 deletions
diff --git a/connect.c b/connect.c
index ce0e121..14c924b 100644
--- a/connect.c
+++ b/connect.c
@@ -310,6 +310,8 @@ static void get_host_and_port(char **host, const char **port)
if (end != colon + 1 && *end == '\0' && 0 <= portnr && portnr < 65536) {
*colon = 0;
*port = colon + 1;
+ } else if (!colon[1]) {
+ *colon = 0;
}
}
}
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index bd37f04..ed40407 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -576,13 +576,16 @@ do
do
for h in host user@host user@[::1] user@::1
do
- test_expect_success "fetch-pack --diag-url $p://$h/$r" '
- check_prot_host_port_path $p://$h/$r $p "$h" NONE "/$r"
- '
- # "/~" -> "~" conversion
- test_expect_success "fetch-pack --diag-url $p://$h/~$r" '
- check_prot_host_port_path $p://$h/~$r $p "$h" NONE "~$r"
- '
+ 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
for h in host User@host User@[::1]
do
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 02b40b1..1befc45 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -387,14 +387,17 @@ do
done
#with ssh:// scheme
-test_expect_success 'clone ssh://host.xz/home/user/repo' '
- test_clone_url "ssh://host.xz/home/user/repo" host.xz "/home/user/repo"
-'
-
-# from home directory
-test_expect_success 'clone ssh://host.xz/~repo' '
- test_clone_url "ssh://host.xz/~repo" host.xz "~repo"
+#ignore trailing colon
+for tcol in "" :
+do
+ test_expect_success "clone ssh://host.xz$tcol/home/user/repo" '
+ test_clone_url "ssh://host.xz$tcol/home/user/repo" host.xz /home/user/repo
+ '
+ # from home directory
+ test_expect_success "clone ssh://host.xz$tcol/~repo" '
+ test_clone_url "ssh://host.xz$tcol/~repo" host.xz "~repo"
'
+done
# with port number
test_expect_success 'clone ssh://host.xz:22/home/user/repo' '
@@ -407,9 +410,9 @@ test_expect_success 'clone ssh://host.xz:22/~repo' '
'
#IPv6
-for tuah in ::1 [::1] user@::1 user@[::1] [user@::1]
+for tuah in ::1 [::1] [::1]: user@::1 user@[::1] user@[::1]: [user@::1] [user@::1]:
do
- ehost=$(echo $tuah | tr -d "[]")
+ ehost=$(echo $tuah | sed -e "s/1]:/1]/ "| tr -d "[]")
test_expect_success "clone ssh://$tuah/home/user/repo" "
test_clone_url ssh://$tuah/home/user/repo $ehost /home/user/repo
"