connect: improve check for plink to reduce false positives
commitbaaf233755f71c057d28b9e8692e24d4fca7d22f
authorbrian m. carlson <sandals@crustytoothpaste.net>
Sun, 26 Apr 2015 20:30:12 +0000 (26 20:30 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 28 Apr 2015 22:23:12 +0000 (28 15:23 -0700)
treef4dd21df1b7ea6028213cf59cfb9cfb8b27dafc8
parentd1018c2494c05e6a27ec5945902306cfb9e45b0c
connect: improve check for plink to reduce false positives

The git_connect function has code to handle plink and tortoiseplink
specially, as they require different command line arguments from
OpenSSH (-P instead of -p for ports; tortoiseplink additionally requires
-batch).  However, the match was done by checking for "plink" anywhere
in the string, which led to a GIT_SSH value containing "uplink" being
treated as an invocation of putty's plink.

Improve the check by looking for "plink" or "tortoiseplink" (or those
names suffixed with ".exe") only in the final component of the path.
This has the downside that a program such as "plink-0.63" would no
longer be recognized, but the increased robustness is likely worth it.
Add tests to cover these cases to avoid regressions.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
connect.c
t/t5601-clone.sh