Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connect: recognize [tortoise]plink in GIT_SSH_COMMAND #1006

Merged
merged 1 commit into from
Jan 2, 2017

Conversation

segevfiner
Copy link

@segevfiner segevfiner commented Dec 23, 2016

When users want to pass some additional arguments to [tortoise]plink via
GIT_SSH, for example, setting a private key, the user is required to either
use a shell script named plink or tortoiseplink or duplicate the logic
that's already in Git for passing the correct style of command line
arguments, which can be difficult, error prone and annoying to get right.
They could have used GIT_SSH_COMMAND but Git doesn't detect [tortoise]plink
in this environment variable, meaning that Git would pass the wrong style
of command line arguments. For example -p instead of -P.

This patch uses the logic that was used to recognize [tortoise]plink in
GIT_SSH for the GIT_SSH_COMMAND environment variable, allowing to use
GIT_SSH_COMMAND with [tortoise]plink directly.

Signed-off-by: Segev Finer [email protected]

@PhilipOakley
Copy link

PhilipOakley commented Dec 24, 2016 via email

@segevfiner
Copy link
Author

@PhilipOakley

This change is actually specific to the GIT_SSH_COMMAND environment variable which existed before. You could set it to a command line that invokes plink, but the logic that determines whether we are invoking plink or not was only used for the GIT_SSH environment variable. Meaning that Git would have passed -p instead of -P, for example, and the invocation would fail. You could write a shell script which would do the necessary conversion when using GIT_SSH_COMMAND but that will defeat the purpose, in my eyes, of GIT_SSH_COMMAND which would be to avoid a shell script.

I hope this clarifies what this change is about.

How about this as a clearer description:

connect: recognize [tortoise]plink in GIT_SSH_COMMAND

When users want to pass some additional arguments to [tortoise]plink via GIT_SSH, for example,
setting a private key, the user is required to either use a shell script named plink or tortoiseplink or
duplicate the logic that's already in Git for passing the correct style of command line arguments, which can be difficult, error prone and annoying to get right. They could have used GIT_SSH_COMMAND
but Git doesn't detect [tortoise]plink in this environment variable, meaning that Git would
pass the wrong style of command line arguments. For example -p instead of -P.

This patch uses the logic that was used to recognize [tortoise]plink in GIT_SSH for the
GIT_SSH_COMMAND environment variable, allowing to use GIT_SSH_COMMAND
with [tortoise]plink directly.

If it's OK I will rewrite the commit with it.

I don't think I caused any change in terms of security. Git used to pass GIT_SSH_COMMAND directly to the shell and that haven't change. I simply added in code to get the first argument (The command) to check if it's plink or not using the same logic that was used for the GIT_SSH environment variable before.

Thanks.

@dscho
Copy link
Member

dscho commented Dec 24, 2016

Thank you for your contribution!

Until next year I will only be able to see the commit on a small screen, and that does not let me assess whether my hunch is correct that there might be a shorter patch accomplishing the same goal.

Could you ping me after January 2nd so I do not forget about this PR? Thanks!

@PhilipOakley
Copy link

PhilipOakley commented Dec 24, 2016 via email

When users want to pass some additional arguments to [tortoise]plink via
GIT_SSH, for example, setting a private key, the user is required to either
use a shell script named plink or tortoiseplink or duplicate the logic
that's already in Git for passing the correct style of command line
arguments, which can be difficult, error prone and annoying to get right.
They could have used GIT_SSH_COMMAND but Git doesn't detect [tortoise]plink
in this environment variable, meaning that Git would pass the wrong style
of command line arguments.  For example -p instead of -P.

This patch uses the logic that was used to recognize [tortoise]plink in
GIT_SSH for the GIT_SSH_COMMAND environment variable, allowing to use
GIT_SSH_COMMAND with [tortoise]plink directly.

Signed-off-by: Segev Finer <[email protected]>
@segevfiner segevfiner force-pushed the git-ssh-command-putty branch from 389e380 to 93c46e1 Compare December 24, 2016 15:26
@dscho dscho merged commit a869cb6 into git-for-windows:master Jan 2, 2017
@dscho
Copy link
Member

dscho commented Jan 2, 2017

Thank you! This iteration is already almost what I will send upstream, it's quicker for me to do the final touch-ups myself.

Thanks again for your contribution!

@dscho dscho added this to the v2.11.1 milestone Jan 2, 2017
dscho added a commit to git-for-windows/build-extra that referenced this pull request Jan 2, 2017
PuTTY's `plink.exe` [can now be used in
`GIT_SSH_COMMAND` without jumping through hoops,
too](git-for-windows/git#1006).

Signed-off-by: Johannes Schindelin <[email protected]>
dscho added a commit that referenced this pull request Jan 11, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Jan 18, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Jan 18, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
git-for-windows-ci pushed a commit that referenced this pull request Jan 18, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
git-for-windows-ci pushed a commit that referenced this pull request Jan 18, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
git-for-windows-ci pushed a commit that referenced this pull request Jan 18, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Jan 24, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Jan 24, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Jan 24, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Jan 25, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Jan 25, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Jan 25, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Jan 25, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit to dscho/git that referenced this pull request Feb 1, 2017
…nd-putty

connect: recognize [tortoise]plink in GIT_SSH_COMMAND
git-for-windows-ci pushed a commit that referenced this pull request Feb 2, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Feb 2, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Feb 2, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
git-for-windows-ci pushed a commit that referenced this pull request Feb 2, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Feb 3, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Feb 4, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Feb 4, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit to dscho/git that referenced this pull request Feb 4, 2017
…nd-putty

connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit to dscho/git that referenced this pull request Feb 21, 2017
…nd-putty

connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Feb 23, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Feb 25, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Mar 1, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
git-for-windows-ci pushed a commit that referenced this pull request Mar 16, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit to dscho/git that referenced this pull request Mar 20, 2017
…nd-putty

connect: recognize [tortoise]plink in GIT_SSH_COMMAND
git-for-windows-ci pushed a commit that referenced this pull request Mar 20, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
git-for-windows-ci pushed a commit that referenced this pull request Mar 21, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
git-for-windows-ci pushed a commit that referenced this pull request Mar 24, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Mar 26, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
git-for-windows-ci pushed a commit that referenced this pull request Mar 28, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Apr 12, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
dscho added a commit that referenced this pull request Apr 26, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
git-for-windows-ci pushed a commit that referenced this pull request Apr 26, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
git-for-windows-ci pushed a commit that referenced this pull request May 10, 2017
connect: recognize [tortoise]plink in GIT_SSH_COMMAND
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants