clone: tighten "local paths with colons" check a bit
[gitweb.git] / connect.c
index 49e56ba35a645359b0d7c1f7bbc9e2108b3424d9..3c6300a21b9b70d2db4adc898be86ab06eb17e6c 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 (host != url || path < strchrnul(host, '/')) {
+                               protocol = PROTO_SSH;
+                               *path++ = '\0';
+                       } else /* '/' in the host part, assume local path */
+                               path = end;
                }
        } else
                path = end;