{"thread":{"id":"35432","subject":"[PATCH v7 01/10] t5601: remove clear_ssh, refactor setup_ssh_wrapper","startedAt":"2013-11-28T19:53:47Z","lastAt":"2013-11-28T19:53:47Z","messageCount":1,"participants":["Torsten Bögershausen"],"isPatch":true,"patchVersion":7,"patchTotal":10},"messages":[{"id":"231262","messageId":"201311282053.47761.tboegi@web.de","threadId":"35432","inReplyTo":null,"subject":"[PATCH v7 01/10] t5601: remove clear_ssh, refactor setup_ssh_wrapper","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2013-11-28T19:53:47Z","receivedAt":"2013-11-28T19:53:47Z","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---\n\nComments to V6:\nCode from Johannes Sixt is part of the series, original found here:\n http://permalink.gmane.org/gmane.comp.version-control.git/237339\n http://permalink.gmane.org/gmane.comp.version-control.git/237338\n\nChanges since V6:\n- git fetch-pack --diag-url uses stdout instead of stderr\n- cleanup in the test scripts\n- Removed [PATCH v6 07/10] connect.c: Corner case for IPv6\n- Added missing sign-off\n- Try to explain better why windows supports file://C:/repo\n  (Actually we should support file:///C:/repo, but we don't\n- Other remarks from code review, did I miss any ?\n\nI'm not sure about 10/10, 2 cleanups which I didn't manage\nto find a  better place to be.\nHowever, I want to concentrate on 1..9, so that 10/10 can be dropped.\n\nAnd a question:\nCan we replace tb/clone-ssh-with-colon-for-port with this stuff ?\nIf we are OK with part 1..4, I don't need to send them again.\n\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..c634f77 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\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.5.rc0.23.gaa27064\n"}]}