Re: [PATCH 2/3] clone: make --local handle URLs
- From
Jeff King <peff@peff.net>
- Date
- May 28, 2012, 19:10 UTC
- Message-ID
- <20120528191030.GB2478@sigill.intra.peff.net>
- In-Reply-To
- <4FC3C46D.5070704@kdbg.org>
On Mon, May 28, 2012 at 08:31:09PM +0200, Johannes Sixt wrote:
Show 21 quoted lines
> Am 26.05.2012 05:45, schrieb Jeff King: > > And did you know that file:// URLs > > can have a hostname in them? How useless. > ... > > +test_expect_success 'cloning file:// turns off local optimizations' ' > > + git clone --bare file://"$PWD"/a non-local && > > + ! repo_is_hardlinked non-local > > +' > > + > > +test_expect_success 'cloning file:// with --local uses hardlinks' ' > > + git clone --bare --local file://"$PWD"/a force-local && > > + repo_is_hardlinked force-local > > +' > > + > > +test_expect_success 'cloning file:// with --local parses URL properly' ' > > + git clone --bare --local file://host/"$PWD"/%61 force-local-odd && > > + repo_is_hardlinked force-local-odd > > +' > > I'm pretty certain that we must use file://c:/path/to/repo on Windows to > make these work. This means we need $(pwd) rather than $PWD.
Ah, sorry, I always forget your pwd woes.
> But what does this mean w.r.t. parsing the URL in the strict sense? Is > "c:" the host part?
Technically, yes. But there is magic in connect.c to handle file://c:/path/to/repo, and include "c:/" as part of the path. And I replicated that logic in my patch (it's the call to has_dos_drive_prefix in url_to_local_path).
-Peff