Skip to content

Commit

Permalink
Windows: Disambiguate DOS style paths from SSH URLs.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Sixt committed Jun 26, 2008
1 parent 6ed807f commit be50181
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
end = host;

path = strchr(end, c);
if (path) {
if (path && !has_dos_drive_prefix(end)) {
if (c == ':') {
protocol = PROTO_SSH;
*path++ = '\0';
Expand Down
3 changes: 2 additions & 1 deletion transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,8 @@ static int is_local(const char *url)
{
const char *colon = strchr(url, ':');
const char *slash = strchr(url, '/');
return !colon || (slash && slash < colon);
return !colon || (slash && slash < colon) ||
has_dos_drive_prefix(url);
}

static int is_file(const char *url)
Expand Down

0 comments on commit be50181

Please sign in to comment.