* [PATCH v6 01/10] t5601: remove clear_ssh, refactor setup_ssh_wrapper
@ 2013-11-21 20:39 Torsten Bögershausen
0 siblings, 0 replies; 3+ messages in thread
From: Torsten Bögershausen @ 2013-11-21 20:39 UTC (permalink / raw)
To: git; +Cc: tboegi
Commit 8d3d28f5 added test cases for URLs which should be ssh.
Remove the function clear_ssh, use test_when_finished to clean up.
Introduce the function setup_ssh_wrapper, which could be factored
out together with expect_ssh.
Tighten one test and use "foo:bar" instead of "./foo:bar",
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
Changes since last version:
- updated t5601, thanks Peff
- Split up the patch into 10 commits
- Hannes suggested 2 patches
- Add tests for git fetch-pack, which verifies the parsing
- Added lots of test cases in t5500 via git fetch-pack --diag-url
t/t5601-clone.sh | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 1d1c875..83b21f5 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -280,25 +280,26 @@ test_expect_success 'clone checking out a tag' '
test_cmp fetch.expected fetch.actual
'
-test_expect_success 'setup ssh wrapper' '
- write_script "$TRASH_DIRECTORY/ssh-wrapper" <<-\EOF &&
- echo >>"$TRASH_DIRECTORY/ssh-output" "ssh: $*" &&
- # throw away all but the last argument, which should be the
- # command
- while test $# -gt 1; do shift; done
- eval "$1"
- EOF
-
- GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper" &&
- export GIT_SSH &&
- export TRASH_DIRECTORY
-'
-
-clear_ssh () {
- >"$TRASH_DIRECTORY/ssh-output"
+setup_ssh_wrapper () {
+ test_expect_success 'setup ssh wrapper' '
+ write_script "$TRASH_DIRECTORY/ssh-wrapper" <<-\EOF &&
+ echo >>"$TRASH_DIRECTORY/ssh-output" "ssh: $*" &&
+ # throw away all but the last argument, which should be the
+ # command
+ while test $# -gt 1; do shift; done
+ eval "$1"
+ EOF
+ GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper" &&
+ export GIT_SSH &&
+ export TRASH_DIRECTORY &&
+ >"$TRASH_DIRECTORY"/ssh-output
+ '
}
expect_ssh () {
+ test_when_finished '
+ (cd "$TRASH_DIRECTORY" && rm -f ssh-expect && >ssh-output)
+ ' &&
{
case "$1" in
none)
@@ -310,21 +311,20 @@ expect_ssh () {
(cd "$TRASH_DIRECTORY" && test_cmp ssh-expect ssh-output)
}
+setup_ssh_wrapper
+
test_expect_success 'cloning myhost:src uses ssh' '
- clear_ssh &&
git clone myhost:src ssh-clone &&
expect_ssh myhost src
'
test_expect_success NOT_MINGW,NOT_CYGWIN 'clone local path foo:bar' '
- clear_ssh &&
cp -R src "foo:bar" &&
- git clone "./foo:bar" foobar &&
+ git clone "foo:bar" foobar &&
expect_ssh none
'
test_expect_success 'bracketed hostnames are still ssh' '
- clear_ssh &&
git clone "[myhost:123]:src" ssh-bracket-clone &&
expect_ssh myhost:123 src
'
--
1.8.4.457.g424cb08
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v6 01/10] t5601: remove clear_ssh, refactor setup_ssh_wrapper
@ 2013-11-21 20:40 Torsten Bögershausen
0 siblings, 0 replies; 3+ messages in thread
From: Torsten Bögershausen @ 2013-11-21 20:40 UTC (permalink / raw)
To: git; +Cc: tboegi
Commit 8d3d28f5 added test cases for URLs which should be ssh.
Remove the function clear_ssh, use test_when_finished to clean up.
Introduce the function setup_ssh_wrapper, which could be factored
out together with expect_ssh.
Tighten one test and use "foo:bar" instead of "./foo:bar",
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
Changes since last version:
- updated t5601, thanks Peff
- Split up the patch into 10 commits
- Hannes suggested 2 patches
- Add tests for git fetch-pack, which verifies the parsing
- Added lots of test cases in t5500 via git fetch-pack --diag-url
t/t5601-clone.sh | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 1d1c875..83b21f5 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -280,25 +280,26 @@ test_expect_success 'clone checking out a tag' '
test_cmp fetch.expected fetch.actual
'
-test_expect_success 'setup ssh wrapper' '
- write_script "$TRASH_DIRECTORY/ssh-wrapper" <<-\EOF &&
- echo >>"$TRASH_DIRECTORY/ssh-output" "ssh: $*" &&
- # throw away all but the last argument, which should be the
- # command
- while test $# -gt 1; do shift; done
- eval "$1"
- EOF
-
- GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper" &&
- export GIT_SSH &&
- export TRASH_DIRECTORY
-'
-
-clear_ssh () {
- >"$TRASH_DIRECTORY/ssh-output"
+setup_ssh_wrapper () {
+ test_expect_success 'setup ssh wrapper' '
+ write_script "$TRASH_DIRECTORY/ssh-wrapper" <<-\EOF &&
+ echo >>"$TRASH_DIRECTORY/ssh-output" "ssh: $*" &&
+ # throw away all but the last argument, which should be the
+ # command
+ while test $# -gt 1; do shift; done
+ eval "$1"
+ EOF
+ GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper" &&
+ export GIT_SSH &&
+ export TRASH_DIRECTORY &&
+ >"$TRASH_DIRECTORY"/ssh-output
+ '
}
expect_ssh () {
+ test_when_finished '
+ (cd "$TRASH_DIRECTORY" && rm -f ssh-expect && >ssh-output)
+ ' &&
{
case "$1" in
none)
@@ -310,21 +311,20 @@ expect_ssh () {
(cd "$TRASH_DIRECTORY" && test_cmp ssh-expect ssh-output)
}
+setup_ssh_wrapper
+
test_expect_success 'cloning myhost:src uses ssh' '
- clear_ssh &&
git clone myhost:src ssh-clone &&
expect_ssh myhost src
'
test_expect_success NOT_MINGW,NOT_CYGWIN 'clone local path foo:bar' '
- clear_ssh &&
cp -R src "foo:bar" &&
- git clone "./foo:bar" foobar &&
+ git clone "foo:bar" foobar &&
expect_ssh none
'
test_expect_success 'bracketed hostnames are still ssh' '
- clear_ssh &&
git clone "[myhost:123]:src" ssh-bracket-clone &&
expect_ssh myhost:123 src
'
--
1.8.4.457.g424cb08
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v6 01/10] t5601: remove clear_ssh, refactor setup_ssh_wrapper
@ 2013-11-21 20:41 Torsten Bögershausen
0 siblings, 0 replies; 3+ messages in thread
From: Torsten Bögershausen @ 2013-11-21 20:41 UTC (permalink / raw)
To: git; +Cc: tboegi
Commit 8d3d28f5 added test cases for URLs which should be ssh.
Remove the function clear_ssh, use test_when_finished to clean up.
Introduce the function setup_ssh_wrapper, which could be factored
out together with expect_ssh.
Tighten one test and use "foo:bar" instead of "./foo:bar",
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
Changes since last version:
- updated t5601, thanks Peff
- Split up the patch into 10 commits
- Hannes suggested 2 patches
- Add tests for git fetch-pack, which verifies the parsing
- Added lots of test cases in t5500 via git fetch-pack --diag-url
t/t5601-clone.sh | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 1d1c875..83b21f5 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -280,25 +280,26 @@ test_expect_success 'clone checking out a tag' '
test_cmp fetch.expected fetch.actual
'
-test_expect_success 'setup ssh wrapper' '
- write_script "$TRASH_DIRECTORY/ssh-wrapper" <<-\EOF &&
- echo >>"$TRASH_DIRECTORY/ssh-output" "ssh: $*" &&
- # throw away all but the last argument, which should be the
- # command
- while test $# -gt 1; do shift; done
- eval "$1"
- EOF
-
- GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper" &&
- export GIT_SSH &&
- export TRASH_DIRECTORY
-'
-
-clear_ssh () {
- >"$TRASH_DIRECTORY/ssh-output"
+setup_ssh_wrapper () {
+ test_expect_success 'setup ssh wrapper' '
+ write_script "$TRASH_DIRECTORY/ssh-wrapper" <<-\EOF &&
+ echo >>"$TRASH_DIRECTORY/ssh-output" "ssh: $*" &&
+ # throw away all but the last argument, which should be the
+ # command
+ while test $# -gt 1; do shift; done
+ eval "$1"
+ EOF
+ GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper" &&
+ export GIT_SSH &&
+ export TRASH_DIRECTORY &&
+ >"$TRASH_DIRECTORY"/ssh-output
+ '
}
expect_ssh () {
+ test_when_finished '
+ (cd "$TRASH_DIRECTORY" && rm -f ssh-expect && >ssh-output)
+ ' &&
{
case "$1" in
none)
@@ -310,21 +311,20 @@ expect_ssh () {
(cd "$TRASH_DIRECTORY" && test_cmp ssh-expect ssh-output)
}
+setup_ssh_wrapper
+
test_expect_success 'cloning myhost:src uses ssh' '
- clear_ssh &&
git clone myhost:src ssh-clone &&
expect_ssh myhost src
'
test_expect_success NOT_MINGW,NOT_CYGWIN 'clone local path foo:bar' '
- clear_ssh &&
cp -R src "foo:bar" &&
- git clone "./foo:bar" foobar &&
+ git clone "foo:bar" foobar &&
expect_ssh none
'
test_expect_success 'bracketed hostnames are still ssh' '
- clear_ssh &&
git clone "[myhost:123]:src" ssh-bracket-clone &&
expect_ssh myhost:123 src
'
--
1.8.4.457.g424cb08
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-21 20:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-21 20:39 [PATCH v6 01/10] t5601: remove clear_ssh, refactor setup_ssh_wrapper Torsten Bögershausen
-- strict thread matches above, loose matches on Subject: below --
2013-11-21 20:40 Torsten Bögershausen
2013-11-21 20:41 Torsten Bögershausen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).