X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=connect.c;h=7945e38ac1c99c09f7975ae99767bc9747ac3740;hb=65d15ed992746068d34b5fa7397ab39a940d2c69;hp=958c831e430340435c31b640bd757d56b7cb8b71;hpb=d1f6c18bd6ea5fd373f9f6356e02854678ffa0fd;p=git.git diff --git a/connect.c b/connect.c index 958c831e4..7945e38ac 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, ':'); @@ -513,7 +513,7 @@ struct child_process *git_connect(int fd[2], const char *url_orig, signal(SIGCHLD, SIG_DFL); host = strstr(url, "://"); - if(host) { + if (host) { *host = '\0'; protocol = get_protocol(url); host += 3; @@ -605,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;