Re: [PATCH V3] git clone: is an URL local or ssh
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Oct 30, 2013, 07:11 UTC
- Message-ID
- <5270B135.8030501@viscovery.net>
- In-Reply-To
- <201310292207.50869.tboegi@web.de>
Am 10/29/2013 22:07, schrieb Torsten Bögershausen:
Show 28 quoted lines
> @@ -610,17 +623,17 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
> } else
> end = host;
>
> - path = strchr(end, c);
> - if (path && !has_dos_drive_prefix(end)) {
> - if (c == ':') {
> - if (host != url || path < strchrnul(host, '/')) {
> - protocol = PROTO_SSH;
> - *path++ = '\0';
> - } else /* '/' in the host part, assume local path */
> - path = end;
> + path = strchr(end, separator);
> + if (separator == ':') {
> + if (path && protocol == PROTO_LOCAL_OR_SSH) {
> + /* We have a ':' */
> + protocol = PROTO_SSH;
> + *path++ = '\0';
> + } else {/* assume local path */
> + protocol = PROTO_LOCAL;
> + path = end;
> }
> - } else
> - path = end;
> + }
>
> if (!path || !*path)
> die("No path specified. See 'man git-pull' for valid url syntax");This hunk breaks on Windows. You removed the has_dos_drive_prefix check.
The check for has_dos_drive_prefix check must happen *before* you further investigate the path/url/host for ssh protocol, and if it returns true, then the path is local, no matter what follows.
-- Hannes