[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    [PATCH 07/11] connect.c: Support PuTTY plink and TortoisePlink as SSH on Windows
From:       Steffen Prohaska <prohaska () zib ! de>
Date:       2009-05-31 16:15:21
Message-ID: 1243786525-4493-8-git-send-email-prohaska () zib ! de
[Download RAW message or body]

From: Edward Z. Yang <edwardzyang@thewritingpot.com>

OpenSSH uses -p to specify custom ports, while PuTTY plink and
TortoisePlink use -P. Git now detects if plink is in GIT_SSH and
modify its flags as necessary.

We call plink with -batch, so that it will error out with an error
message instead of waiting for user input.  As reported in msysGit
issue 96, plink wants to interact with the user asking if a host
key should be accepted, but this just blocks the terminal, since
plink tries to get the answer from stdin.  However, stdin is
already connected to Git that wants to send input to the remote
command.

But we do not pass -batch to TortoisePlink, because TortoisePlink
uses a GUI to communicate with the user, and it does not understand
-batch.

Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 connect.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/connect.c b/connect.c
index f6b8ba6..692d476 100644
--- a/connect.c
+++ b/connect.c
@@ -602,14 +602,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;
-- 
1.6.3.1.54.g99dd

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic