Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7483e08

Browse files
MrHackycarlosmn
authored andcommitted
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.
1 parent a299d0a commit 7483e08

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/transports/git.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ static int gen_proto(git_buf *request, const char *cmd, const char *url)
5050
}
5151

5252
repo = delim;
53+
if (repo[1] == '~')
54+
++repo;
5355

5456
delim = strchr(url, ':');
5557
if (delim == NULL)

src/transports/ssh.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ static int gen_proto(git_buf *request, const char *cmd, const char *url)
6666
if (!git__prefixcmp(url, prefix_ssh)) {
6767
url = url + strlen(prefix_ssh);
6868
repo = strchr(url, '/');
69+
if (repo && repo[1] == '~')
70+
++repo;
6971
} else {
7072
repo = strchr(url, ':');
7173
if (repo) repo++;

0 commit comments

Comments
 (0)