]> git.ipfire.org Git - thirdparty/git.git/commit - t/t5601-clone.sh
connect: handle putty/plink also in GIT_SSH_COMMAND
authorSegev Finer <segev208@gmail.com>
Mon, 2 Jan 2017 12:09:03 +0000 (13:09 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Jan 2017 21:47:22 +0000 (13:47 -0800)
commite9d9a8a4d281d1f5945c710c65b6f6ee26478923
treee58c45e8c1108dfe94c691599f9782e243b7334b
parent4e59582ff70d299f5a88449891e78d15b4b3fabe
connect: handle putty/plink also in GIT_SSH_COMMAND

Git for Windows has special support for the popular SSH client PuTTY:
when using PuTTY's non-interactive version ("plink.exe"), we use the -P
option to specify the port rather than OpenSSH's -p option. TortoiseGit
ships with its own, forked version of plink.exe, that adds support for
the -batch option, and for good measure we special-case that, too.

However, this special-casing of PuTTY only covers the case where the
user overrides the SSH command via the environment variable GIT_SSH
(which allows specifying the name of the executable), not
GIT_SSH_COMMAND (which allows specifying a full command, including
additional command-line options).

When users want to pass any additional arguments to (Tortoise-)Plink,
such as setting a private key, they are required to either use a shell
script named plink or tortoiseplink or duplicate the logic that is
already in Git for passing the correct style of command line arguments,
which can be difficult, error prone and annoying to get right.

This patch simply reuses the existing logic and expands it to cover
GIT_SSH_COMMAND, too.

Note: it may look a little heavy-handed to duplicate the entire
command-line and then split it, only to extract the name of the
executable. However, this is not a performance-critical code path, and
the code is much more readable this way.

Signed-off-by: Segev Finer <segev208@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
connect.c
t/t5601-clone.sh