From: Junio C Hamano Date: Sat, 27 Apr 2013 21:16:49 GMT Subject: Re: [PATCH] clone: allow cloning local paths with colons in them Message-ID: <7vip37u11a.fsf@alter.siamese.dyndns.org> In-Reply-To: <1367033778-13923-1-git-send-email-pclouds@gmail.com> Nguyễn Thái Ngọc Duy writes: > diff --git a/connect.c b/connect.c > index f57efd0..b568f10 100644 > --- a/connect.c > +++ b/connect.c > @@ -551,8 +551,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 (!strchr(url, '/') || strchr(url, '/') >= path) { > + protocol = PROTO_SSH; > + *path++ = '\0'; > + } else > + path = end; > } That was fairly hard to grok. Is that equivalent to this? if (c == ':' && path < strchrnul(host, '/')) { /* is the first slash past the colon? */ protocol = PROTO_SSH; *path++ = '\0'; } else { path = end; }