{"thread":{"id":"35427","subject":"[PATCH v7 06/10] t5500: Test case for diag-url","startedAt":"2013-11-28T19:49:29Z","lastAt":"2013-11-28T19:49:29Z","messageCount":1,"participants":["Torsten Bögershausen"],"isPatch":true,"patchVersion":7,"patchTotal":10},"messages":[{"id":"231257","messageId":"201311282049.30311.tboegi@web.de","threadId":"35427","inReplyTo":null,"subject":"[PATCH v7 06/10] t5500: Test case for diag-url","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2013-11-28T19:49:29Z","receivedAt":"2013-11-28T19:49:29Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"Add test cases using git fetch-pack --diag-url:\n\n- parse out host and path for URLs with a scheme (git:// file:// ssh://)\n- parse host names embedded by [] correctly\n- extract the port number, if present\n- separate URLs like \"file\" (which are local)\n  from URLs like \"host:repo\" which should use ssh\n\nSigned-off-by: Torsten Bögershausen <tboegi@web.de>\n---\n t/t5500-fetch-pack.sh | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 59 insertions(+)\n\ndiff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh\nindex d87ddf7..a2b37af 100755\n--- a/t/t5500-fetch-pack.sh\n+++ b/t/t5500-fetch-pack.sh\n@@ -531,5 +531,64 @@ test_expect_success 'shallow fetch with tags does not break the repository' '\n \t\tgit fsck\n \t)\n '\n+check_prot_path() {\n+\tcat >expected <<-EOF &&\n+\tDiag: url=$1\n+\tDiag: protocol=$2\n+\tDiag: path=$3\n+\tEOF\n+\tgit fetch-pack --diag-url \"$1\" | grep -v hostandport= >actual &&\n+\ttest_cmp expected actual\n+}\n+\n+check_prot_host_path() {\n+\tcat >expected <<-EOF &&\n+\tDiag: url=$1\n+\tDiag: protocol=$2\n+\tDiag: hostandport=$3\n+\tDiag: path=$4\n+\tEOF\n+\tgit fetch-pack --diag-url \"$1\" >actual &&\n+\ttest_cmp expected actual\n+}\n+\n+for r in repo re:po re/po\n+do\n+\t# git or ssh with scheme\n+\tfor p in \"ssh+git\" \"git+ssh\" git ssh\n+\tdo\n+\t\tfor h in host host:12 [::1] [::1]:23\n+\t\tdo\n+\t\t\tcase \"$p\" in\n+\t\t\t*ssh*)\n+\t\t\t\thh=$(echo $h | tr -d \"[]\")\n+\t\t\t\tpp=ssh\n+\t\t\t\t;;\n+\t\t\t*)\n+\t\t\t\thh=$h\n+\t\t\t\tpp=$p\n+\t\t\t;;\n+\t\t\tesac\n+\t\t\ttest_expect_success \"fetch-pack --diag-url $p://$h/$r\" '\n+\t\t\t\tcheck_prot_host_path $p://$h/$r $pp \"$hh\" \"/$r\"\n+\t\t\t'\n+\t\t\t# \"/~\" -> \"~\" conversion\n+\t\t\ttest_expect_success \"fetch-pack --diag-url $p://$h/~$r\" '\n+\t\t\t\tcheck_prot_host_path $p://$h/~$r $pp \"$hh\" \"~$r\"\n+\t\t\t'\n+\t\tdone\n+\tdone\n+\t# file with scheme\n+\tfor p in file\n+\tdo\n+\t\ttest_expect_success \"fetch-pack --diag-url $p://$h/$r\" '\n+\t\t\tcheck_prot_path $p://$h/$r $p \"/$r\"\n+\t\t'\n+\t\t# No \"/~\" -> \"~\" conversion for file\n+\t\ttest_expect_success \"fetch-pack --diag-url $p://$h/~$r\" '\n+\t\t\tcheck_prot_path $p://$h/~$r $p \"/~$r\"\n+\t\t'\n+\tdone\n+done\n \n test_done\n-- \n1.8.5.rc0.23.gaa27064\n"}]}