Re: [PATCH 3/3] fallback SSH_ASKPASS when GIT_ASKPASS not set
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 24, 2010, 16:24 UTC
- Message-ID
- <7vocje38ll.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1267024554-3288-1-git-send-email-lznuaa@gmail.com>
Frank Li <lznuaa@gmail.com> writes:
> If GIT_ASKPASS is not set and SSH_ASKPASS set, GIT_ASKPASS will > use SSH_ASKPASS. If GIT_ASKPASS set and SSH_ASKPASS is not set, > SSH_ASKPASS will use GIT_ASKPASS.
If both are set and to different values, what should happen?
I think the basic idea is sound, but I am not sure if we should fallback on both ways. If both GIT_ASKPASS and SSH_ASKPASS are set, the user is probably telling us to use GIT_ASKPASS when git does something, similar to how GIT_EDITOR and EDITOR interacts.
So probably the patch to implement the fallback should be more like
if (SSH_ASKPASS is set but not GIT_ASKPASS)
set GIT_ASKPASS from SSH_ASKPASSand then the password prompter should use GIT_ASKPASS exclusively.
Of course, when we _do_ spawn ssh ourselves internally in connect.c, we may have to export the value of GIT_ASKPASS as SSH_ASKPASS at the call site to honor the user's request to use GIT_ASKPASS while in git (that is part of "use GIT_ASKPASS exclusively").
But it feels wrong if we exported SSH_ASKPASS set from GIT_ASKPASS when spawning processes in other codepaths, especially if SSH_ASKPASS is set (or unset) differently from GIT_ASKPASS.
Shawn is CC'ed as git-gui currently honors only SSH_ASKPASS and this patch changes the behaviour slightly.