Allow core.askpass to override SSH_ASKPASS.
PATCH 2/2 Allow core.askpass to override SSH_ASKPASS.
From: Knut Franke <[email protected]>
Modify handling of the 'core.askpass' option so that it has the same effect as GIT_ASKPASS also if SSH_ASKPASS is set.
---
I'd say this precedence order is more intuitive; and more useful.
connect.c | 4 ++++ git.c | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-)
connect.c +4 -0
@@ -627,9 +627,13 @@ char *git_getpass(const char *prompt)static struct strbuf buffer =STRBUF_INIT ; askpass =getenv ("GIT_ASKPASS" ); +if (!askpass) askpass = askpass_program; +if (!askpass) + askpass =getenv ("SSH_ASKPASS" ); +if (!askpass || !(*askpass))return getpass (prompt);
git.c +0 -0
@@ -55,9 +55,6 @@ static int handle_options(const char ***argv, int *argc, int
*envchanged)
{
int handled = 0;
- if (!getenv("GIT_ASKPASS") && getenv("SSH_ASKPASS"))
- setenv("GIT_ASKPASS", getenv("SSH_ASKPASS"), 1);
-
while (*argc > 0) {
const char *cmd = (*argv)[0];
if (cmd[0] != '-')
Signature · 13 lines
1.7.2.1 -- Vorstand/Board of Management: Dr. Bernd Finkbeiner, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Michel Lepert Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196
Quoted 2 lines · Knut Franke
From: Knut Franke <[email protected]>
You don't need this line unless you're forwarding a patch for someone else (or using a different e-mail account).
Quoted 3 lines
Modify handling of the 'core.askpass' option so that it has the same effect as
GIT_ASKPASSalso ifSSH_ASKPASSis set.
Why are you sending a two-patch series where the second patch tries to correct the first one? Wouldn't it make more sense to squash the two?
Quoted 13 lines
Signed-off-by Knut Franke <[email protected]>---
I'd say this precedence order is more intuitive; and more useful.connect.c | 4 ++++
git.c | 3 ---2 files changed, 4 insertions(+), 3 deletions(-)connect.c +0
-0
connect.c char *git_getpass(const char *prompt) · line 630
Quoted 4 lines
connect.c +1
-0@@ -627,9 +627,13 @@ char *git_getpass(const char *prompt) static struct strbuf buffer = STRBUF_INIT; askpass = getenv("GIT_ASKPASS"); +
Why?
Apart from these nits, I think the patch does the right thing. IMO it doesn't make sense for SSH_ASKPASS to trump core.askpass.
Quoted 4 lines · On Friday 27 August 2010 14:00:16 Erik Faye-Lund wrote:
Quoted 1 line
From: Knut Franke <[email protected]>
You don't need this line unless you're forwarding a patch for someone else (or using a different e-mail account).
ACK.
Quoted 5 lines
Quoted 2 lines
Modify handling of the 'core.askpass' option so that it has the same effect as
GIT_ASKPASSalso ifSSH_ASKPASSis set.Why are you sending a two-patch series where the second patch tries to correct the first one? Wouldn't it make more sense to squash the two?
a) The author of the first patch is on holiday, and I didn't want to pass off his work as mine nor my mistakes as his. ;-)
b) Maybe not everyone agrees about the correct order of precedence.
Quoted 11 lines
connect.c char *git_getpass(const char *prompt) · line 630
Quoted 9 lines
connect.c +1
-0@@ -627,9 +627,13 @@ char *git_getpass(const char *prompt) static struct strbuf buffer = STRBUF_INIT; askpass = getenv("GIT_ASKPASS"); +Why?
Considering the check for SSH_ASKPASS added below, I believe this improves legibilty since all of the "if (!askpass..." blocks are similar in intention.
Signature · 9 lines
Vorstand/Board of Management: Dr. Bernd Finkbeiner, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Michel Lepert Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196
Quoted 7 lines · Knut Franke
Quoted 7 lines
Quoted 7 lines
connect.c +0
-0@@ -627,9 +627,13 @@ char *git_getpass(const char *prompt)static struct strbuf buffer =STRBUF_INIT ;
Quoted 7 lines
Quoted 4 lines
connect.c char *git_getpass(const char *prompt) · line 630
Quoted 2 lines
connect.c +1
-0askpass =getenv ("GIT_ASKPASS" ); +Why?
Considering the check for
SSH_ASKPASSadded below, I believe this improves legibilty since all of the "if (!askpass..." blocks are similar in intention.
I think Erik is asking about the extra blank line. You could have achieved the same consistency by removing, no?
connect.c +2 -1
@@ -627,9 +627,10 @@ char *git_getpass(const char *prompt)static struct strbuf buffer =STRBUF_INIT ; askpass =getenv ("GIT_ASKPASS" );if (!askpass) askpass = askpass_program; - +if (!askpass) + askpass =getenv ("SSH_ASKPASS" );if (!askpass || !(*askpass))return getpass (prompt);