projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
checkout: sometimes work from a subdirectory.
[git.git]
/
connect.c
diff --git
a/connect.c
b/connect.c
index
7a417e5
..
6b6d613
100644
(file)
--- a/
connect.c
+++ b/
connect.c
@@
-427,7
+427,7
@@
static int git_tcp_connect(int fd[2], const char *prog, char *host, char *path)
memset(&sa, 0, sizeof sa);
sa.sin_family = he->h_addrtype;
sa.sin_port = htons(nport);
memset(&sa, 0, sizeof sa);
sa.sin_family = he->h_addrtype;
sa.sin_port = htons(nport);
- memcpy(&sa.sin_addr, ap, he->h_length);
+ memcpy(&sa.sin_addr,
*
ap, he->h_length);
if (connect(sockfd, (struct sockaddr *)&sa, sizeof sa) < 0) {
close(sockfd);
if (connect(sockfd, (struct sockaddr *)&sa, sizeof sa) < 0) {
close(sockfd);
@@
-561,7
+561,8
@@
int git_connect(int fd[2], char *url, const char *prog)
{
char command[1024];
char *host, *path = url;
{
char command[1024];
char *host, *path = url;
- char *colon = NULL;
+ char *end;
+ int c;
int pipefd[2][2];
pid_t pid;
enum protocol protocol = PROTO_LOCAL;
int pipefd[2][2];
pid_t pid;
enum protocol protocol = PROTO_LOCAL;
@@
-571,15
+572,30
@@
int git_connect(int fd[2], char *url, const char *prog)
*host = '\0';
protocol = get_protocol(url);
host += 3;
*host = '\0';
protocol = get_protocol(url);
host += 3;
- path = strchr(host, '/');
- }
- else {
+ c = '/';
+ } else {
host = url;
host = url;
- if ((colon = strchr(host, ':'))) {
+ c = ':';
+ }
+
+ if (host[0] == '[') {
+ end = strchr(host + 1, ']');
+ if (end) {
+ *end = 0;
+ end++;
+ host++;
+ } else
+ end = host;
+ } else
+ end = host;
+
+ path = strchr(end, c);
+ if (c == ':') {
+ if (path) {
protocol = PROTO_SSH;
protocol = PROTO_SSH;
- *
colon
= '\0';
- path = colon + 1;
- }
+ *
path++
= '\0';
+ } else
+ path = host;
}
if (!path || !*path)
}
if (!path || !*path)