{"thread":{"id":"26471","subject":"Re: [msysGit] git-svn.perl should check GIT_ASKPASS environment","startedAt":"2011-02-11T09:25:45Z","lastAt":"2011-02-11T11:34:13Z","messageCount":4,"participants":["Erik Faye-Lund","Frank Li"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"160884","messageId":"AANLkTinkv0dNxNxehud0Byuu9tpqxp1kBMJ1OyEcfVQ_@mail.gmail.com","threadId":"26471","inReplyTo":"1c47e93c-5b7c-4aed-8a78-807d3aff2700@n36g2000pre.googlegroups.com","subject":"Re: [msysGit] git-svn.perl should check GIT_ASKPASS environment","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2011-02-11T09:25:45Z","receivedAt":"2011-02-11T09:25:45Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Fri, Feb 11, 2011 at 9:17 AM, Jose Roberto Garcia Chico\n<jose@toro-asia.com> wrote:\n> git-svn.perl problem.\n>\n> prompt:\n>        print STDERR $may_save ?\n>              \"(R)eject, accept (t)emporarily or accept (p)ermanently? \" :\n>              \"(R)eject or accept (t)emporarily? \";\n>        STDERR->flush;\n>        $choice = lc(substr(<STDIN> || 'R', 0, 1));\n>\n> should check GIT_ASKPASS environment.\n>\n> For further information\n>\n> http://code.google.com/p/tortoisegit/issues/detail?id=706\n>\n\nAs was already said in the thread you're linking to, this isn't a\nWindows-specific git-issue. CC'ing the main Git mailing list, where\nthis discussion belongs.\n\nBut I don't think it should check GIT_ASKPASS, GIT_ASKPASS isn't a\ngeneral-purpose dialog-box hook, it's a hook for getting *passwords*.\nTo allow git-svn to query the user of a non-terminal user, another\nmechanism would probably be created. But in any case, I we should do\nsomething other than just waiting if we're not connected to a TTY. I\ndon't really know Perl that well, but perhaps something like this does\nthe trick?\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 177dd25..24f3486 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -3964,6 +3964,9 @@ sub ssl_server_trust {\n \t                               issuer_dname fingerprint);\n \tmy $choice;\n prompt:\n+\tif (!-t STDERR || !-t STDIN) {\n+\t\treturn -1;\n+\t}\n \tprint STDERR $may_save ?\n \t      \"(R)eject, accept (t)emporarily or accept (p)ermanently? \" :\n \t      \"(R)eject or accept (t)emporarily? \";\n"},{"id":"160885","messageId":"AANLkTik9mFNsqFQn5SEZkYd_uxDeoY-9nqgV_PJ+nNsi@mail.gmail.com","threadId":"26471","inReplyTo":"AANLkTinkv0dNxNxehud0Byuu9tpqxp1kBMJ1OyEcfVQ_@mail.gmail.com","subject":"Re: [msysGit] git-svn.perl should check GIT_ASKPASS environment","fromName":"Frank Li","fromEmail":"lznuaa@gmail.com","sentAt":"2011-02-11T09:37:03Z","receivedAt":"2011-02-11T09:37:03Z","isPatch":false,"sender":{"key":"lznuaa@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40642?v=4"},"body":"> But I don't think it should check GIT_ASKPASS, GIT_ASKPASS isn't a\n> general-purpose dialog-box hook, it's a hook for getting *passwords*.\n> To allow git-svn to query the user of a non-terminal user, another\n> mechanism would probably be created. But in any case, I we should do\n> something other than just waiting if we're not connected to a TTY. I\n> don't really know Perl that well, but perhaps something like this does\n> the trick?\n>\n\nSSH_ASKPASS is used to accept \"Enter your OpenSSH passphrase\".\nrefer to git-gui/git-gui--askpass\n\nGIT_ASKPASS should be similar with SSH_ASKPASS.\ngit-svn can use GIT_ASKPASS hook to launch third part application to\naccept certification.\n"},{"id":"160887","messageId":"AANLkTinWLTfU_WmxTCvz+P=rcXY=2u25Eo2QZWmDMdSh@mail.gmail.com","threadId":"26471","inReplyTo":"AANLkTik9mFNsqFQn5SEZkYd_uxDeoY-9nqgV_PJ+nNsi@mail.gmail.com","subject":"Re: [msysGit] git-svn.perl should check GIT_ASKPASS environment","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2011-02-11T10:28:34Z","receivedAt":"2011-02-11T10:28:34Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Fri, Feb 11, 2011 at 10:37 AM, Frank Li <lznuaa@gmail.com> wrote:\n>> But I don't think it should check GIT_ASKPASS, GIT_ASKPASS isn't a\n>> general-purpose dialog-box hook, it's a hook for getting *passwords*.\n>> To allow git-svn to query the user of a non-terminal user, another\n>> mechanism would probably be created. But in any case, I we should do\n>> something other than just waiting if we're not connected to a TTY. I\n>> don't really know Perl that well, but perhaps something like this does\n>> the trick?\n>>\n>\n> SSH_ASKPASS is used to accept \"Enter your OpenSSH passphrase\".\n> refer to git-gui/git-gui--askpass\n>\n\ngit-gui--askpass can ask for a password, or yes/no questions. But this\nis neither, it's a reject/accept temporary/accept permanently\nquestion.\n\nPerhaps the prompt could be rewritten as two yes/no questions, though?\nSomething like \"Accept certificate? (yes/no)\" and if the answer is\n\"yes\", query with something like \"Store certificate? (yes/no)\".\nDunno...\n"},{"id":"160890","messageId":"AANLkTim3fdevQYuE5R12D0b-AxVKaksPWDcMUedG-t6+@mail.gmail.com","threadId":"26471","inReplyTo":"AANLkTinWLTfU_WmxTCvz+P=rcXY=2u25Eo2QZWmDMdSh@mail.gmail.com","subject":"Re: [msysGit] git-svn.perl should check GIT_ASKPASS environment","fromName":"Frank Li","fromEmail":"lznuaa@gmail.com","sentAt":"2011-02-11T11:34:13Z","receivedAt":"2011-02-11T11:34:13Z","isPatch":false,"sender":{"key":"lznuaa@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40642?v=4"},"body":">> SSH_ASKPASS is used to accept \"Enter your OpenSSH passphrase\".\n>> refer to git-gui/git-gui--askpass\n>>\n>\n> git-gui--askpass can ask for a password, or yes/no questions. But this\n> is neither, it's a reject/accept temporary/accept permanently\n> question.\n>\n> Perhaps the prompt could be rewritten as two yes/no questions, though?\n> Something like \"Accept certificate? (yes/no)\" and if the answer is\n> \"yes\", query with something like \"Store certificate? (yes/no)\".\n\nI think that's fine.\nFrank Li\n"}]}