git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] Filenames with single colon being treated as remote repository

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Apr 21, 2013, 16:56 UTC
Message-ID
<20130421165606.GA29687@elie.Belkin>
In-Reply-To
<20130421124511.GA1933@sigill.intra.peff.net>
Jeff King wrote:
> I don't think that is enough. Something like /path/to/foo:bar would
> trigger !is_url already, but then git_connect fails.
Doh.  Here's another try, still untested.
diff --git i/connect.c w/connect.c
index 49e56ba3..fe13942f 100644
--- i/connect.c
+++ w/connect.c
@@ -504,6 +504,7 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
 	int c;
 	struct child_process *conn = &no_fork;
 	enum protocol protocol = PROTO_LOCAL;
+	struct stat st;
 	int free_path = 0;
 	char *port = NULL;
 	const char **arg;
@@ -548,7 +549,8 @@ struct child_process *git_connect(int fd[2], const char *url_orig,
 		end = host;
 
 	path = strchr(end, c);
-	if (path && !has_dos_drive_prefix(end)) {
+	if (path && !has_dos_drive_prefix(end) &&
+	    (c != ':' || stat(path, &st))) {
 		if (c == ':') {
 			protocol = PROTO_SSH;
 			*path++ = '\0';
Previous: Jeff KingNext: Junio C Hamano
Message 4 of 16 in “[BUG] Filenames with single colon being treated as remote repository”
  1. William GiokasApr 21, 2013
  2. Jonathan NiederApr 21, 2013
  3. Jeff KingApr 21, 2013
  4. Jonathan NiederApr 21, 2013
  5. Junio C HamanoApr 21, 2013
  6. Jeff KingApr 22, 2013
  7. Junio C HamanoApr 22, 2013
  8. clone: allow cloning local paths with colons in themNguyễn Thái Ngọc Duy, Apr 27, 2013
  9. William GiokasApr 27, 2013
  10. Junio C HamanoApr 27, 2013
  11. Duy NguyenApr 28, 2013
  12. Eric SunshineApr 28, 2013
  13. Duy NguyenApr 28, 2013
  14. clone: allow cloning local paths with colons in themNguyễn Thái Ngọc Duy, May 4, 2013
  15. Junio C HamanoMay 7, 2013
  16. Jeff KingMay 7, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.