Re: [msysGit] [PATCH 06/12] connect: Fix custom ports with plink (Putty's ssh)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Jul 3, 2008, at 1:10 PM, Johannes Schindelin wrote:

On Wed, 2 Jul 2008, Johannes Sixt wrote:

On Mittwoch, 2. Juli 2008, Steffen Prohaska wrote:
From: Edward Z. Yang <edwardzyang@xxxxxxxxxxxxxxxxx>

PuTTY requires -P while OpenSSH requires -p; if plink is detected
as GIT_SSH, use the alternate flag.

Signed-off-by: Edward Z. Yang <edwardzyang@xxxxxxxxxxxxxxxxx>
Signed-off-by: Steffen Prohaska <prohaska@xxxxxx>
---
connect.c |    4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/connect.c b/connect.c
index 574f42f..0d007f3 100644
--- a/connect.c
+++ b/connect.c
@@ -599,11 +599,13 @@ struct child_process *git_connect(int fd[2], const
char *url_orig, conn->argv = arg = xcalloc(6, sizeof(*arg));
	if (protocol == PROTO_SSH) {
		const char *ssh = getenv("GIT_SSH");
+		int putty = ssh && strstr(ssh, "plink");
		if (!ssh) ssh = "ssh";

		*arg++ = ssh;
		if (port) {
-			*arg++ = "-p";
+			/* P is for PuTTY, p is for OpenSSH */
+			*arg++ = putty ? "-P" : "-p";
			*arg++ = port;
		}
		*arg++ = host;

What about installing a wrapper script, plinkssh, that does this:

#!/bin/bash

if test "$1" = -p; then
	port="-P $2"
	shift; shift
fi

exec plink $port "$@"

and require plink users to set GIT_SSH=plinkssh?

I like that better than this special-casing of plink.


I'd prefer to change connect.c.  plinkssh would introduce another
dependency on the shell, while our overall goal is to avoid shell as
much as possible on Windows, no?  Edward's solution also looks more
obvious to me than the plinkssh wrapper script.

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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux