{"thread":{"id":"35381","subject":"[PATCH v6 01/10] t5601: remove clear_ssh, refactor setup_ssh_wrapper","startedAt":"2013-11-21T20:40:32Z","lastAt":"2013-11-21T20:40:32Z","messageCount":1,"participants":["Torsten Bögershausen"],"isPatch":true,"patchVersion":6,"patchTotal":10},"messages":[{"id":"230906","messageId":"201311212140.33594.tboegi@web.de","threadId":"35381","inReplyTo":null,"subject":"[PATCH v6 01/10] t5601: remove clear_ssh, refactor setup_ssh_wrapper","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2013-11-21T20:40:32Z","receivedAt":"2013-11-21T20:40:32Z","isPatch":true,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"Commit 8d3d28f5 added test cases for URLs which should be ssh.\nRemove the function clear_ssh, use test_when_finished to clean up.\n\nIntroduce the function setup_ssh_wrapper, which could be factored\nout together with expect_ssh.\n\nTighten one test and use \"foo:bar\" instead of \"./foo:bar\",\n\nHelped-by: Jeff King <peff@peff.net>\nSigned-off-by: Torsten Bögershausen <tboegi@web.de>\n---\nChanges since last version:\n- updated t5601, thanks Peff\n- Split up the patch into 10 commits\n- Hannes suggested 2 patches\n- Add tests for git fetch-pack, which verifies the parsing\n- Added lots of test cases in t5500 via git fetch-pack --diag-url\n\n t/t5601-clone.sh | 40 ++++++++++++++++++++--------------------\n 1 file changed, 20 insertions(+), 20 deletions(-)\n\ndiff --git a/t/t5601-clone.sh b/t/t5601-clone.sh\nindex 1d1c875..83b21f5 100755\n--- a/t/t5601-clone.sh\n+++ b/t/t5601-clone.sh\n@@ -280,25 +280,26 @@ test_expect_success 'clone checking out a tag' '\n \ttest_cmp fetch.expected fetch.actual\n '\n \n-test_expect_success 'setup ssh wrapper' '\n-\twrite_script \"$TRASH_DIRECTORY/ssh-wrapper\" <<-\\EOF &&\n-\techo >>\"$TRASH_DIRECTORY/ssh-output\" \"ssh: $*\" &&\n-\t# throw away all but the last argument, which should be the\n-\t# command\n-\twhile test $# -gt 1; do shift; done\n-\teval \"$1\"\n-\tEOF\n-\n-\tGIT_SSH=\"$TRASH_DIRECTORY/ssh-wrapper\" &&\n-\texport GIT_SSH &&\n-\texport TRASH_DIRECTORY\n-'\n-\n-clear_ssh () {\n-\t>\"$TRASH_DIRECTORY/ssh-output\"\n+setup_ssh_wrapper () {\n+\ttest_expect_success 'setup ssh wrapper' '\n+\t\twrite_script \"$TRASH_DIRECTORY/ssh-wrapper\" <<-\\EOF &&\n+\t\techo >>\"$TRASH_DIRECTORY/ssh-output\" \"ssh: $*\" &&\n+\t\t# throw away all but the last argument, which should be the\n+\t\t# command\n+\t\twhile test $# -gt 1; do shift; done\n+\t\teval \"$1\"\n+\t\tEOF\n+\t\tGIT_SSH=\"$TRASH_DIRECTORY/ssh-wrapper\" &&\n+\t\texport GIT_SSH &&\n+\t\texport TRASH_DIRECTORY &&\n+\t\t>\"$TRASH_DIRECTORY\"/ssh-output\n+\t'\n }\n \n expect_ssh () {\n+\ttest_when_finished '\n+\t  (cd \"$TRASH_DIRECTORY\" && rm -f ssh-expect && >ssh-output)\n+\t' &&\n \t{\n \t\tcase \"$1\" in\n \t\tnone)\n@@ -310,21 +311,20 @@ expect_ssh () {\n \t(cd \"$TRASH_DIRECTORY\" && test_cmp ssh-expect ssh-output)\n }\n \n+setup_ssh_wrapper\n+\n test_expect_success 'cloning myhost:src uses ssh' '\n-\tclear_ssh &&\n \tgit clone myhost:src ssh-clone &&\n \texpect_ssh myhost src\n '\n \n test_expect_success NOT_MINGW,NOT_CYGWIN 'clone local path foo:bar' '\n-\tclear_ssh &&\n \tcp -R src \"foo:bar\" &&\n-\tgit clone \"./foo:bar\" foobar &&\n+\tgit clone \"foo:bar\" foobar &&\n \texpect_ssh none\n '\n \n test_expect_success 'bracketed hostnames are still ssh' '\n-\tclear_ssh &&\n \tgit clone \"[myhost:123]:src\" ssh-bracket-clone &&\n \texpect_ssh myhost:123 src\n '\n-- \n1.8.4.457.g424cb08\n"}]}