fallback SSH_ASKPASS when GIT_ASKPASS not set
authorFrank Li <lznuaa@gmail.com>
Tue, 2 Mar 2010 11:52:11 +0000 (19:52 +0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 2 Mar 2010 20:15:41 +0000 (12:15 -0800)
If GIT_ASKPASS is not set and SSH_ASKPASS set, GIT_ASKPASS will
use SSH_ASKPASS.

Signed-off-by: Frank Li <lznuaa@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git.c

diff --git a/git.c b/git.c
index 90c6daf153493f70a35c99212a3cf0461f7fb03e..f09948eed952aa14614ad3c17475f63ad02fbc6e 100644 (file)
--- a/git.c
+++ b/git.c
@@ -54,6 +54,9 @@ 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] != '-')