From: Johannes Sixt Date: Wed, 27 Feb 2008 18:54:44 GMT Subject: [PATCH 21/40] Windows: Disambiguate DOS style paths from SSH URLs. Message-ID: <1204138503-6126-22-git-send-email-johannes.sixt@telecom.at> In-Reply-To: <1204138503-6126-1-git-send-email-johannes.sixt@telecom.at> If on Windows a path is specified as C:/path, then this is also a valid SSH URL. To disambiguate between the two interpretations we require that a SSH URL must have a host name with at least two characters. Signed-off-by: Johannes Sixt --- connect.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/connect.c b/connect.c index 5ac3572..7e18ac8 100644 --- a/connect.c +++ b/connect.c @@ -529,7 +529,13 @@ struct child_process *git_connect(int fd[2], const char *url_orig, end = host; path = strchr(end, c); - if (path) { +#ifdef __MINGW32__ + /* host must have at least 2 chars to catch DOS C:/path */ + if (path && path - end > 1) +#else + if (path) +#endif + { if (c == ':') { protocol = PROTO_SSH; *path++ = '\0'; -- 1.5.4.1.126.ge5a7d