[PATCH v4 01/11] add fetch-pack --diag-url tests for some corner cases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



t5603-clone-dirname uses url patterns that are not tested with
fetch-pack --diag-url, and it would be useful if they were.

Interestingly, some of those tests, involving both a port and a
user:password pair, don't currently pass. Note that even if a
user:password pair is actually not supported by git, the values used
could be valid user names (user names can actually contain colons
and at signs), and are still worth testing the url parser for.

Signed-off-by: Mike Hommey <mh@xxxxxxxxxxxx>
---
 t/t5500-fetch-pack.sh | 38 ++++++++++++++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 4 deletions(-)

Note I'm not /entirely/ sure about colons in user names, but ssh happily
sends requests to authenticate with logins containing colons. I however
*do* know it works with at signs (hg.mozilla.org ssh accounts are email
addresses).

diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
index e5f83bf..1f0133f 100755
--- a/t/t5500-fetch-pack.sh
+++ b/t/t5500-fetch-pack.sh
@@ -569,12 +569,27 @@ check_prot_host_port_path () {
 	test_cmp expected actual
 }
 
-for r in repo re:po re/po
+test_maybe_fail () {
+	host=$1; shift
+	case $host in
+		git=*)
+		test_expect_success "$@"
+		;;
+		*:*@*)
+		test_expect_failure "$@"
+		;;
+		*)
+		test_expect_success "$@"
+		;;
+	esac
+}
+
+for r in repo re:po re/po re@po
 do
 	# git or ssh with scheme
 	for p in "ssh+git" "git+ssh" git ssh
 	do
-		for h in host user@host user@[::1] user@::1
+		for h in host user@host user@[::1] user@::1 user:password@host user:passw@rd@host
 		do
 			for c in "" :
 			do
@@ -587,9 +602,12 @@ do
 				'
 			done
 		done
-		for h in host User@host User@[::1]
+		for h in host User@host User@[::1] User:password@host User:passw@rd@host
 		do
-			test_expect_success "fetch-pack --diag-url $p://$h:22/$r" '
+			test_maybe_fail "$p=$h" "fetch-pack --diag-url $p://$h:22/$r" '
+				check_prot_host_port_path $p://$h:22/$r $p "$h" 22 "/$r"
+			'
+			test_maybe_fail "$p=$h" "fetch-pack --diag-url $p://$h:22/$r" '
 				check_prot_host_port_path $p://$h:22/$r $p "$h" 22 "/$r"
 			'
 		done
@@ -628,6 +646,18 @@ do
 			check_prot_host_port_path $h:/~$r $p "$h" NONE "~$r"
 		'
 	done
+	#ssh without scheme with port
+	p=ssh
+	for h in host user@host user:password@host user:passw@rd@host
+	do
+		test_maybe_fail "$h" "fetch-pack --diag-url [$h:22]:$r" '
+			check_prot_host_port_path [$h:22]:$r $p $h 22 "$r"
+		'
+		# Do "/~" -> "~" conversion
+		test_maybe_fail "$h" "fetch-pack --diag-url [$h:22]:/~$r" '
+			check_prot_host_port_path [$h:22]:/~$r $p $h 22 "~$r"
+		'
+	done
 done
 
 test_expect_success MINGW 'fetch-pack --diag-url file://c:/repo' '
-- 
2.8.1.16.gaa70619.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]