X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=connect.c;h=76e542776abff8d07e7250ecfc8c7ae813302b2d;hb=4f6339b0c353b5c03b566b605e50a743d97fc08e;hp=f6b8ba6fec16ed2ff2de4c66e2465e79d059a817;hpb=2c8f8b19d4f293edd78885880ed1a6166395ffdd;p=git.git diff --git a/connect.c b/connect.c index f6b8ba6fe..76e542776 100644 --- a/connect.c +++ b/connect.c @@ -464,7 +464,7 @@ static void git_proxy_connect(int fd[2], char *host) #define MAX_CMD_LEN 1024 -char *get_port(char *host) +static char *get_port(char *host) { char *end; char *p = strchr(host, ':'); @@ -579,7 +579,10 @@ struct child_process *git_connect(int fd[2], const char *url_orig, git_tcp_connect(fd, host, flags); /* * Separate original protocol components prog and path - * from extended components with a NUL byte. + * from extended host header with a NUL byte. + * + * Note: Do not add any other headers here! Doing so + * will cause older git-daemon servers to crash. */ packet_write(fd[1], "%s %s%chost=%s%c", @@ -602,14 +605,18 @@ struct child_process *git_connect(int fd[2], const char *url_orig, die("command line too long"); conn->in = conn->out = -1; - conn->argv = arg = xcalloc(6, sizeof(*arg)); + conn->argv = arg = xcalloc(7, sizeof(*arg)); if (protocol == PROTO_SSH) { const char *ssh = getenv("GIT_SSH"); + int putty = ssh && strcasestr(ssh, "plink"); if (!ssh) ssh = "ssh"; *arg++ = ssh; + if (putty && !strcasestr(ssh, "tortoiseplink")) + *arg++ = "-batch"; if (port) { - *arg++ = "-p"; + /* P is for PuTTY, p is for OpenSSH */ + *arg++ = putty ? "-P" : "-p"; *arg++ = port; } *arg++ = host;