Commit 3cf4eb0922f8a495f04fe6da1e33d1802e700879

Carlos Martín Nieto 2015-08-03T10:29:17

Merge pull request #3348 from MrHacky/remote-path-with-tilde Handle ssh:// and git:// urls containing a '~' character.

diff --git a/src/transports/git.c b/src/transports/git.c
index 7e0a474..52de92d 100644
--- a/src/transports/git.c
+++ b/src/transports/git.c
@@ -50,6 +50,8 @@ static int gen_proto(git_buf *request, const char *cmd, const char *url)
 	}
 
 	repo = delim;
+	if (repo[1] == '~')
+		++repo;
 
 	delim = strchr(url, ':');
 	if (delim == NULL)
diff --git a/src/transports/ssh.c b/src/transports/ssh.c
index 0b0d4ba..8f5a716 100644
--- a/src/transports/ssh.c
+++ b/src/transports/ssh.c
@@ -66,6 +66,8 @@ static int gen_proto(git_buf *request, const char *cmd, const char *url)
 	if (!git__prefixcmp(url, prefix_ssh)) {
 		url = url + strlen(prefix_ssh);
 		repo = strchr(url, '/');
+		if (repo && repo[1] == '~')
+			++repo;
 	} else {
 		repo = strchr(url, ':');
 		if (repo) repo++;