Git development
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Fredrik Tolf <fredrik@dolda2000.com>,
	Keith Packard <keithp@keithp.com>,
	git@vger.kernel.org,
	"Edward Z. Yang" <edwardzyang@thewritingpot.com>,
	Steffen Prohaska <prohaska@zib.de>
Subject: Re: [PATCH] Ensure that SSH runs in non-interactive mode
Date: Sun, 20 Jul 2008 20:57:48 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.1.00.0807202035090.3305@eeepc-johanness> (raw)
In-Reply-To: <7v63r0bejy.fsf@gitster.siamese.dyndns.org>

Hi,

On Sun, 20 Jul 2008, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> >> Ah, right. Would it be OK to add the `-x' flag to ssh instead?
> >
> > I think this would be the correct way, together with "-T".
> >
> >> I imagine that that might make git less portable to SSH implementations 
> >> other than OpenSSH, but I don't know if that is considered a problem.
> >
> > Well, this was to be expected, after what I wrote in response to 3. in
> > http://thread.gmane.org/gmane.comp.version-control.git/76650/focus=2598
> >
> > Reality always catches up with you, and here again we see that plink and 
> > other siblings of OpenSSH should be best handled with scripts, preferably 
> > ones that strip out options they do not recognize.
> >
> > IOW something like
> >
> > -- snip --
> > #!/bin/bash
> >
> > plinkopt=
> > while test $# != 0
> > do
> > 	case "$1" in
> > 	-p)
> > 		plinkopt="$plinkopt -P $2"
> > 		shift
> > 	;;
> > 	-*)
> > 		# unrecognized; strip out
> > 	;;
> > 	*)
> > 		break
> > 	;;
> > 	esac
> > 	shift
> > done
> >
> > exec plink $plinkopt "$@"
> > -- snap --
> 
> I think that is a very sensible approach, but just like we have a few
> "built-in" function-header regexps with customization possibilities for
> the user, we might want to:
> 
>  * Have that "-x", "-T" in the command line we generate for OpenSSH;
> 
>  * Allow users to specify OpenSSH substitute via a configuration and/or
>    environment variable, and have them use your script; and
> 
>  * Have a built-in logic for selected and common "OpenSSH substitute",
>    e.g. plink.
> 
> There is no reason to make users suffer an extra redirection for common
> enough alternatives.
> 
> Here is to get it started...

How about this instead?

-- snipsnap --
diff --git a/connect.c b/connect.c
index 574f42f..7e7f4d3 100644
--- a/connect.c
+++ b/connect.c
@@ -603,7 +603,8 @@ struct child_process *git_connect(int fd[2], const char *url
 
 		*arg++ = ssh;
 		if (port) {
-			*arg++ = "-p";
+			const char *opt = getenv("GIT_SSH_PORT_OPTION");
+			*arg++ = opt ? opt : "-p";
 			*arg++ = port;
 		}
 		*arg++ = host;

  reply	other threads:[~2008-07-20 18:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-19 17:06 [PATCH] Ensure that SSH runs in non-interactive mode Fredrik Tolf
2008-07-19 17:52 ` Mike Hommey
2008-07-19 17:57 ` Keith Packard
2008-07-19 18:18   ` Fredrik Tolf
2008-07-20 10:27     ` Johannes Schindelin
2008-07-20 17:49       ` Fredrik Tolf
2008-07-20 18:33         ` Johannes Schindelin
2008-07-20 18:42           ` Fredrik Tolf
2008-07-20 18:23       ` Junio C Hamano
2008-07-20 18:57         ` Johannes Schindelin [this message]
2008-07-20 19:51           ` Junio C Hamano
2008-07-20 22:17             ` Johannes Schindelin
2008-07-21  5:07             ` Steffen Prohaska
2008-07-21  0:14         ` Jeff King
2008-07-21  6:53           ` Mike Hommey
2008-07-21  7:05             ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.1.00.0807202035090.3305@eeepc-johanness \
    --to=johannes.schindelin@gmx.de \
    --cc=edwardzyang@thewritingpot.com \
    --cc=fredrik@dolda2000.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=keithp@keithp.com \
    --cc=prohaska@zib.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox