Re: [PATCH 3/5] ssh: 'auto' variant to select between 'ssh' and 'simple'
From: Stefan Beller <hidden>
Date: 2017-10-23 22:33:17
On Mon, Oct 23, 2017 at 2:31 PM, Jonathan Nieder [off-list ref] wrote:
1. First, check whether $GIT_SSH supports OpenSSH options by running
$GIT_SSH -G <options> <host>
This returns status 0 and prints configuration in OpenSSH if it
recognizes all <options> and returns status 255 if it encounters
an unrecognized option. A wrapper script like
exec ssh -- "$@"
would fail with
ssh: Could not resolve hostname -g: Name or service not knowncapital -G?
- if (variant == VARIANT_TORTOISEPLINK) - argv_array_push(&conn->args, "-batch"); + detect.use_shell = conn->use_shell;
Why do we have to use a shell for evaluation of this test balloon?
+ detect.no_stdin = detect.no_stdout = detect.no_stderr = 1;
okay. ...
+ argv_array_push(&detect.args, "-G");
...
+ variant = run_command(&detect) ? VARIANT_SIMPLE : VARIANT_SSH;
What if we have a VARIANT_SIMPLE, that doesn't care about -G but just connects to the remote host (keeping the session open), do we need to kill it after some time to have run_command return eventually? Or can we give a command to be executed remotely (e.g. 'false') that we know returns quickly?
' +test_expect_success 'OpenSSH-like uplink is treated as ssh' ' + write_script "$TRASH_DIRECTORY/uplink" <<-EOF && + if test "\$1" = "-G"
Reading this test (and the commit message) I realize, we do care about the order of options, so this is fine.