aboutsummaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorTorsten Bögershausen <tboegi@web.de>2013-11-28 20:49:38 +0100
committerJunio C Hamano <gitster@pobox.com>2013-12-09 14:54:47 -0800
commit6a59974869c0a6e9399101bc02223b4c00a8aff2 (patch)
tree8d3a9ce35fe91b08ff128079bf9fb92147c5d014 /connect.c
parent854aeb7beb85a7a3f05fc11daea7c8d2fed3a22c (diff)
downloadgit-6a59974869c0a6e9399101bc02223b4c00a8aff2.tar.gz
git-6a59974869c0a6e9399101bc02223b4c00a8aff2.tar.xz
git fetch: support host:/~repo
The documentation (in urls.txt) says that "ssh://host:/~repo", "host:/~repo" or "host:~repo" specify the repository "repo" in the home directory at "host". This has not been working for "host:/~repo". Before commit 356bec "Support [address] in URLs", the comparison "url != hostname" could be used to determine if the URL had a scheme or not: "ssh://host/host" != "host". However, after 356bec "[::1]" was converted into "::1", yielding url != hostname as well. To fix this regression, don't use "if (url != hostname)", but look at the separator instead. Rename the variable "c" into "separator" to make it easier to read. Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/connect.c b/connect.c
index a16bdaf0b..7e5f608a2 100644
--- a/connect.c
+++ b/connect.c
@@ -567,7 +567,7 @@ static enum protocol parse_connect_url(const char *url_orig, char **ret_host,
char *url;
char *host, *path;
char *end;
- int c;
+ int separator;
enum protocol protocol = PROTO_LOCAL;
int free_path = 0;
char *port = NULL;
@@ -582,10 +582,10 @@ static enum protocol parse_connect_url(const char *url_orig, char **ret_host,
*host = '\0';
protocol = get_protocol(url);
host += 3;
- c = '/';
+ separator = '/';
} else {
host = url;
- c = ':';
+ separator = ':';
}
/*
@@ -605,9 +605,9 @@ static enum protocol parse_connect_url(const char *url_orig, char **ret_host,
} else
end = host;
- path = strchr(end, c);
+ path = strchr(end, separator);
if (path && !has_dos_drive_prefix(end)) {
- if (c == ':') {
+ if (separator == ':') {
if (host != url || path < strchrnul(host, '/')) {
protocol = PROTO_SSH;
*path++ = '\0';
@@ -624,7 +624,7 @@ static enum protocol parse_connect_url(const char *url_orig, char **ret_host,
* null-terminate hostname and point path to ~ for URL's like this:
* ssh://host.xz/~user/repo
*/
- if (protocol != PROTO_LOCAL && host != url) {
+ if (protocol != PROTO_LOCAL) {
char *ptr = path;
if (path[1] == '~')
path++;
@@ -639,7 +639,7 @@ static enum protocol parse_connect_url(const char *url_orig, char **ret_host,
/*
* Add support for ssh port: ssh://host.xy:<port>/...
*/
- if (protocol == PROTO_SSH && host != url)
+ if (protocol == PROTO_SSH && separator == '/')
port = get_port(end);
*ret_host = xstrdup(host);