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

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
Previous: Johannes Sixt
Message 4 of 4 in “git clone: is an URL local or ssh”
  1. git clone: is an URL local or sshTorsten Bögershausen, Oct 29, 2013
  2. Jeff KingOct 30, 2013
  3. Johannes SixtOct 30, 2013
  4. Johannes SixtOct 30, 2013

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.