From ac728c248361df6ab8c23d8c5cfece7391c871db Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 3 Aug 2015 07:38:07 +0100 Subject: [PATCH] Handle ssh:// and git:// urls containing a '~' character. For such a path '/~/...' the leading '/' is stripped so the server will get a path starting with '~' and correctly handle it. --- src/transports/git.c | 2 ++ src/transports/ssh.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/transports/git.c b/src/transports/git.c index 7e0a47414..52de92d09 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 0b0d4bac3..8f5a7164b 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++;