From: Jeff King <peff@peff.net>
To: "Torsten Bögershausen" <tboegi@web.de>
Cc: git@vger.kernel.org, sunshine@sunshineco.com, pclouds@gmail.com
Subject: Re: [PATCH V3] git clone: is an URL local or ssh
Date: Wed, 30 Oct 2013 02:42:31 -0400 [thread overview]
Message-ID: <20131030064231.GA11317@sigill.intra.peff.net> (raw)
In-Reply-To: <201310292207.50869.tboegi@web.de>
On Tue, Oct 29, 2013 at 10:07:50PM +0100, Torsten Bögershausen wrote:
> Changes since V2:
> clear_ssh and expect_ssh did come back
> And I couldn't get it working without the
> >"$TRASH_DIRECTORY/ssh-output"
Thanks.
> test_when_finished:
> I could not get that to work. Probably because of the
> battle between the quotings: '"' "'" '"'
The quoting should be straight-forward, since you can do it in
expect_ssh, outside of the regular test eval. But what is tricky is that
you do not actually want "ssh-output" to disappear, but rather you want
it to be an empty file, so that tests which do not trigger ssh can
compare against it using test_cmp.
The patch below makes it work, but I'm thinking that it does not
actually improve readability. While the "clear_ssh" call is something
each test needs to remember, at least it is obvious there that the test
is clearing the state before running the clone.
> Other note about test_might_fail:
> The first version did not need it, git clone did
> always succeed.
> After a while it always failed.
> According to my understanding, git clone ssh://xxx.yy
> should fail (as we can not clone) ??
Cloning over ssh via our fake wrapper should work, as the wrapper finds
the shell command and execs it. So ssh://host/path should end up
running:
ssh host 'git-upload-pack path'
and the ssh wrapper converts that to:
git-upload-pack path
If we want to make it more robust, we could cd into a "hosts/$host"
directory that simulates the remote host, but I don't know if that is
necessary.
---
This is the test_when_finished patch.
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 7db7f48..05afe5a 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -291,14 +291,14 @@ test_expect_success 'setup ssh wrapper' '
GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper" &&
export GIT_SSH &&
- export TRASH_DIRECTORY
+ export TRASH_DIRECTORY &&
+ >"$TRASH_DIRECTORY"/ssh-output
'
-clear_ssh () {
- >"$TRASH_DIRECTORY/ssh-output"
-}
-
expect_ssh () {
+ test_when_finished '
+ (cd "$TRASH_DIRECTORY" && rm -f ssh-expect && >ssh-output)
+ ' &&
{
case "$1" in
none)
@@ -311,7 +311,6 @@ expect_ssh () {
}
test_expect_success NOT_MINGW,NOT_CYGWIN 'clone local path foo:bar' '
- clear_ssh &&
cp -R src "foo:bar" &&
git clone "foo:bar" foobar &&
expect_ssh none
@@ -323,7 +322,6 @@ counter=0
# $3 path
test_clone_url () {
counter=$(($counter + 1))
- clear_ssh &&
test_might_fail git clone "$1" tmp$counter &&
expect_ssh "$2" "$3"
}
next prev parent reply other threads:[~2013-10-30 6:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-29 21:07 [PATCH V3] git clone: is an URL local or ssh Torsten Bögershausen
2013-10-30 6:42 ` Jeff King [this message]
2013-10-30 6:52 ` Johannes Sixt
2013-10-30 7:11 ` Johannes Sixt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131030064231.GA11317@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=pclouds@gmail.com \
--cc=sunshine@sunshineco.com \
--cc=tboegi@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).