On Wed, Apr 22, 2015 at 04:29:10PM -0400, Jeff King wrote: > I think you want something like: > > diff --git a/connect.c b/connect.c > index 9ae991a..58aad56 100644 > --- a/connect.c > +++ b/connect.c > @@ -568,7 +568,8 @@ struct child_process *git_connect(int fd[2], const char *url_orig, > conn->argv = arg = xcalloc(7, sizeof(*arg)); > if (protocol == PROTO_SSH) { > const char *ssh = getenv("GIT_SSH"); > - int putty = ssh && strcasestr(ssh, "plink"); > + int putty = ssh && (ends_with(ssh, "plink") || > + ends_with("plink.exe")); > if (!ssh) ssh = "ssh"; > > *arg++ = ssh; > > though that is not quite enough (we do not have a case-insensitive > version of "ends_with"). I'm also not sure if matching just "plink" and > "plink.exe" at the end of the string is enough (I'm just guessing that > was the original reason for using strstr in the first place). > > Note that I don't think just switching the strcasestr to look for > "plink.exe" is right. For one thing, it just punts on the problem (it > can still happen, it's just less likely to trigger). But for another, > you can have plink (without ".exe") on Linux systems. 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. -- 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