git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Error when cloning with weird local directory

From
Torsten Bögershausen <tboegi@web.de>
Date
Aug 8, 2015, 06:26 UTC
Message-ID
<55C5A111.6050902@web.de>
In-Reply-To
<xmqqpp30zwhu.fsf@gitster.dls.corp.google.com>
On 2015-08-06 09.50, Junio C Hamano wrote:
Show 13 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
> 
>> Torsten Bögershausen <tboegi@web.de> writes:
>>
>>> It looks as if
>>> static char *get_repo_path(const char *repo, int *is_bundle)
>>> in built/clone.c
>>> checks if there is a local directory structure looking like a
>>> .git directory.
>>> This is wrong.
>>
>> It is as designed, though, to allow cloning from a local directory
>> with any name.
I see the point, but this is what I would expect as a user:
git clone ssh://host/path         # Always ssh, never local
git clone ./ssh://host/path       # Always local
git clone host:path               # scp syntax, border case:
                                  # if a git repo host:path exists on disc,
                                  # use it
git clone ./host:path             # local, not scp ('/' before ':')

Beside that, git fetch, git fetch-pack all use the transport helper from transport.c: transport struct transport *transport_get(struct remote *remote, const char *url)

to let the URL being parsed and to make the decision if an URL without a scheme is ssh or a local file.

So I think that git clone can be slighty more consistant here.
Show 17 quoted lines
>>
>>> There should be a check for the scheme first.
>>
>> That will be wrong.
> 
> It matters mostly when dealing with scp-like syntax, word:path.
> 
> I _think_ taking notice of "word://" (with doubled slashes) and
> treating it specially will not introduce any new issue; while it is
> still OK for users to have a local directory called "word:", if they
> meant a subdirectory of it, they wouldn't have typed double-slashes
> there.
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 6 in “Error when cloning with weird local directory”
  1. Chris PackhamAug 6, 2015
  2. Torsten BögershausenAug 6, 2015
  3. Junio C HamanoAug 6, 2015
  4. Junio C HamanoAug 6, 2015
  5. Torsten BögershausenAug 8, 2015
  6. Junio C HamanoAug 10, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.