Re: [PATCH 1/2] git-svn, perl/Git.pm: add central method for prompting passwords honoring GIT_ASKPASS and SSH_ASKPASS
- From
Jeff King <peff@peff.net>
- Date
- Jan 4, 2012, 13:34 UTC
- Message-ID
- <20120104133459.GA6564@sigill.intra.peff.net>
- In-Reply-To
- <4F040E46.5030001@tu-clausthal.de>
On Wed, Jan 04, 2012 at 09:31:02AM +0100, Sven Strickroth wrote:
Show 23 quoted lines
> diff --git a/prompt.c b/prompt.c
> index 72ab9de..e791619 100644
> --- a/prompt.c
> +++ b/prompt.c
> @@ -52,9 +52,17 @@ char *git_prompt(const char *prompt, int flags)
> }
>
> r = git_terminal_prompt(prompt, flags & PROMPT_ECHO);
> - if (!r)
> - die_errno("could not read '%s'", prompt);
> - return r;
> + if (r)
> + return r;
> +
> + if (flags & PROMPT_ASKPASS) {
> + const char *askpass;
> + askpass = getenv("SSH_ASKPASS");
> + if (askpass && *askpass)
> + return do_askpass(askpass, prompt);
> + }
> +
> + die_errno("could not read '%s'", prompt);
> }Wouldn't you also have to drop checking of SSH_ASKPASS in the block right before calling git_terminal_prompt (right before the context in your patch)?
-Peff