diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2013-05-04 09:19:33 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-05-07 08:32:14 -0700 |
commit | 60003340cda05f5ecd79ee8522b21eda038b994b (patch) | |
tree | 6d072e229727d6a3a73ac36c7685a006be95a443 /connect.c | |
parent | 239222f587ed06f96d90dd71c66d80a2b1e3dc9f (diff) | |
download | git-60003340cda05f5ecd79ee8522b21eda038b994b.tar.gz |
clone: allow cloning local paths with colons in them
Usually "foo:bar" is interpreted as an ssh url. This patch allows to
clone from such paths by putting at least one slash before the colon
(i.e. /path/to/foo:bar or just ./foo:bar).
file://foo:bar should also work, but local optimizations are off in
that case, which may be unwanted. While at there, warn the users about
--local being ignored in this case.
Reported-by: William Giokas <1007380@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'connect.c')
-rw-r--r-- | connect.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -550,8 +550,11 @@ struct child_process *git_connect(int fd[2], const char *url_orig, path = strchr(end, c); if (path && !has_dos_drive_prefix(end)) { if (c == ':') { - protocol = PROTO_SSH; - *path++ = '\0'; + if (path < strchrnul(host, '/')) { + protocol = PROTO_SSH; + *path++ = '\0'; + } else /* '/' in the host part, assume local path */ + path = end; } } else path = end; |