Skip to content

Commit 9718c7c

Browse files
committed
Merge branch 'tb/connect-ipv6-parse-fix'
An earlier update to the parser that disects an address broke an address, followed by a colon, followed by an empty string (instead of the port number). * tb/connect-ipv6-parse-fix: connect.c: ignore extra colon after hostname
2 parents a59ac46 + 6b6c5f7 commit 9718c7c

File tree

3 files changed

+24
-16
lines changed

3 files changed

+24
-16
lines changed

connect.c

+2
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,8 @@ static void get_host_and_port(char **host, const char **port)
310310
if (end != colon + 1 && *end == '\0' && 0 <= portnr && portnr < 65536) {
311311
*colon = 0;
312312
*port = colon + 1;
313+
} else if (!colon[1]) {
314+
*colon = 0;
313315
}
314316
}
315317
}

t/t5500-fetch-pack.sh

+10-7
Original file line numberDiff line numberDiff line change
@@ -576,13 +576,16 @@ do
576576
do
577577
for h in host user@host user@[::1] user@::1
578578
do
579-
test_expect_success "fetch-pack --diag-url $p://$h/$r" '
580-
check_prot_host_port_path $p://$h/$r $p "$h" NONE "/$r"
581-
'
582-
# "/~" -> "~" conversion
583-
test_expect_success "fetch-pack --diag-url $p://$h/~$r" '
584-
check_prot_host_port_path $p://$h/~$r $p "$h" NONE "~$r"
585-
'
579+
for c in "" :
580+
do
581+
test_expect_success "fetch-pack --diag-url $p://$h$c/$r" '
582+
check_prot_host_port_path $p://$h/$r $p "$h" NONE "/$r"
583+
'
584+
# "/~" -> "~" conversion
585+
test_expect_success "fetch-pack --diag-url $p://$h$c/~$r" '
586+
check_prot_host_port_path $p://$h/~$r $p "$h" NONE "~$r"
587+
'
588+
done
586589
done
587590
for h in host User@host User@[::1]
588591
do

t/t5601-clone.sh

+12-9
Original file line numberDiff line numberDiff line change
@@ -387,14 +387,17 @@ do
387387
done
388388

389389
#with ssh:// scheme
390-
test_expect_success 'clone ssh://host.xz/home/user/repo' '
391-
test_clone_url "ssh://host.xz/home/user/repo" host.xz "/home/user/repo"
392-
'
393-
394-
# from home directory
395-
test_expect_success 'clone ssh://host.xz/~repo' '
396-
test_clone_url "ssh://host.xz/~repo" host.xz "~repo"
390+
#ignore trailing colon
391+
for tcol in "" :
392+
do
393+
test_expect_success "clone ssh://host.xz$tcol/home/user/repo" '
394+
test_clone_url "ssh://host.xz$tcol/home/user/repo" host.xz /home/user/repo
395+
'
396+
# from home directory
397+
test_expect_success "clone ssh://host.xz$tcol/~repo" '
398+
test_clone_url "ssh://host.xz$tcol/~repo" host.xz "~repo"
397399
'
400+
done
398401

399402
# with port number
400403
test_expect_success 'clone ssh://host.xz:22/home/user/repo' '
@@ -407,9 +410,9 @@ test_expect_success 'clone ssh://host.xz:22/~repo' '
407410
'
408411

409412
#IPv6
410-
for tuah in ::1 [::1] user@::1 user@[::1] [user@::1]
413+
for tuah in ::1 [::1] [::1]: user@::1 user@[::1] user@[::1]: [user@::1] [user@::1]:
411414
do
412-
ehost=$(echo $tuah | tr -d "[]")
415+
ehost=$(echo $tuah | sed -e "s/1]:/1]/ "| tr -d "[]")
413416
test_expect_success "clone ssh://$tuah/home/user/repo" "
414417
test_clone_url ssh://$tuah/home/user/repo $ehost /home/user/repo
415418
"

0 commit comments

Comments
 (0)