Re: [PATCH v2] clone: allow cloning local paths with colons in them
- From
Jeff King <peff@peff.net>
- Date
- May 7, 2013, 16:47 UTC
- Message-ID
- <20130507164727.GA5078@sigill.intra.peff.net>
- In-Reply-To
- <7vehdils6c.fsf@alter.siamese.dyndns.org>
On Tue, May 07, 2013 at 08:34:51AM -0700, Junio C Hamano wrote:
Show 19 quoted lines
> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes: > > > diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh > > index 67869b4..0629149 100755 > > --- a/t/t5601-clone.sh > > +++ b/t/t5601-clone.sh > > @@ -280,4 +280,9 @@ test_expect_success 'clone checking out a tag' ' > > test_cmp fetch.expected fetch.actual > > ' > > > > +test_expect_success NOT_MINGW,NOT_CYGWIN 'clone local path foo:bar' ' > > + cp -R src "foo:bar" && > > + git clone "./foo:bar" foobar > > +' > > Hmph, why not > > git clone --mirror src foo:bar && > git clone ./foo:bar foobar
Yeah, not only does that avoid "cp -R", but it is a nice check that we do not do anything stupid with colons on the dst argument (which we should obviously not, but it cannot hurt to exercise it).
> or something? Also do we have a easy negative case we want to test, > i.e. a case where we do not want the new codepath to trigger by > mistake?
Yeah, checking "git clone host:path" would be nice, but such a case would want to go through ssh. I suspect we could point GIT_SSH at a script like:
#!/bin/sh echo "ssh: $*" >ssh-log && host=$1; shift cd "pretend-hosts/$host" && exec "$@"
It looks like t5602 does something similar already.
-Peff