On Wed, Apr 22, 2015 at 05:29:04PM -0400, Jeff King wrote:
> > Perhaps it would be worthwhile to check instead if the text "plink" is
> > the beginning of string or is preceded by a path separator.  That would
> > give us a bit more confidence that the user is looking for plink, but
> > would still allow people to use "plink-0.63" if they like.
> 
> Yeah, I think that is a reasonable approach. Note that it needs to
> handle the "tortoiseplink" case from below, too (you can still use your
> strategy, you just need to look for either string).

So maybe something like this?

diff --git a/connect.c b/connect.c
index 391d211..ba3ab34 100644
--- a/connect.c
+++ b/connect.c
@@ -749,10 +749,15 @@ struct child_process *git_connect(int fd[2], const char 
*url,
                                        conn->use_shell = 1;
                                        putty = 0;
                                } else {
+                                       char *plink, *tplink;
+
                                        ssh = getenv("GIT_SSH");
                                        if (!ssh)
                                                ssh = "ssh";
-                                       putty = !!strcasestr(ssh, "plink");
+                                       plink = strcasestr(ssh, "plink");
+                                       tplink = strcasestr(ssh, 
"tortoiseplink");
+                                       putty = plink == ssh || (plink && 
is_dir_sep(plink[-1])) ||
+                                               tplink == ssh || (tplink && 
is_dir_sep(tplink[-1]));
                                }
 
                                argv_array_push(&conn->args, ssh);
-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187

Attachment: signature.asc
Description: Digital signature

Reply via email to