Windows: Disambiguate DOS style paths from SSH URLs.
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 take an URL that looks like a path with a drive letter as a local URL. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Johannes Sixt committed
Nov 30, 2007 at 22:51 UTC
be501813d25bedc1a441940f349fb91bd9fa4ef6
2 files changed
+3
-2
connect.c
+1
-1
@@ -529,7 +529,7 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
529
end = host;
530
531
path = strchr(end, c);
532
- if (path) {
532
+ if (path && !has_dos_drive_prefix(end)) {
533
if (c == ':') {
534
protocol = PROTO_SSH;
535
*path++ = '\0';
transport.c
+2
-1
@@ -709,7 +709,8 @@ static int is_local(const char *url)
709
{
710
const char *colon = strchr(url, ':');
711
const char *slash = strchr(url, '/');
712
- return !colon || (slash && slash < colon);
712
+ return !colon || (slash && slash < colon) ||
713
+ has_dos_drive_prefix(url);
714
}
715
716
static int is_file(const char *url)