clone: allow cloning local paths with colons in them
[gitweb.git] / connect.c
index 49e56ba35a645359b0d7c1f7bbc9e2108b3424d9..715a309d2152b5d8ba5624b38657a714adaf67b5 100644 (file)
--- a/connect.c
+++ b/connect.c
@@ -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;