Re: [PATCH] honour GIT_ASKPASS for querying username in git-svn
- From
Jeff King <peff@peff.net>
- Date
- Nov 30, 2011, 06:44 UTC
- Message-ID
- <20111130064401.GC5317@sigill.intra.peff.net>
- In-Reply-To
- <4ED0CE8B.70205@tu-clausthal.de>
On Sat, Nov 26, 2011 at 12:33:31PM +0100, Sven Strickroth wrote:
Show 17 quoted lines
> diff --git a/git-svn.perl b/git-svn.perl
> index e30df22..d7aeb11 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -4361,7 +4361,14 @@ prompt:
> "(R)eject, accept (t)emporarily or accept (p)ermanently? " :
> "(R)eject or accept (t)emporarily? ";
> STDERR->flush;
> - $choice = lc(substr(<STDIN> || 'R', 0, 1));
> + if (exists $ENV{GIT_ASKPASS}) {
> + print STDERR "\n";
> + open(PH, "-|", $ENV{GIT_ASKPASS}, "Certificate unknown");
> + $choice = lc(substr(<PH> || 'R', 0, 1));
> + close(PH);
> + } else {
> + $choice = lc(substr(<STDIN> || 'R', 0, 1));
> + }Why is the prompt simply "Certificate unknown"? Shouldn't it mention that the right answers are "(R)eject, accept (t)emporarily, ..."?
That aside, I think this is an improvement over the current code. But having just been looking at regular git's askpass code, I notice there are some subtle differences:
1. Regular git will also respect SSH_ASKPASS
2. Regular git will ignore an askpass variable that is set but empty.
Perhaps git-svn should be refactored to have a reusable "prompt" function that respects askpass and tries to behave like C git? It could even go into the Git perl module.
-Peff