From: Laszlo Papp <djszapi@archlinux.us>
To: Frank Li <lznuaa@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/1] Use GIT_ASKPASS environment to launch thirdpart UI app to get password
Date: Wed, 24 Feb 2010 00:31:39 +0100 [thread overview]
Message-ID: <a362e8011002231531k17725788sb45e70428c33848b@mail.gmail.com> (raw)
In-Reply-To: <1266923463-2828-1-git-send-email-lznuaa@gmail.com>
Nice to see someone who are interested in the solution to hack it :-)
On 2/23/10, Frank Li <lznuaa@gmail.com> wrote:
> Default git-svn read charactor from terminal to get password. GUI will
> wait forever because don't know password need input.
>
> Signed-off-by: Frank Li <lznuaa@gmail.com>
> ---
> git-svn.perl | 27 +++++++++++++++++----------
> 1 files changed, 17 insertions(+), 10 deletions(-)
>
> diff --git a/git-svn.perl b/git-svn.perl
> index 265852f..f9f104e 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -3966,18 +3966,25 @@ sub username {
>
> sub _read_password {
> my ($prompt, $realm) = @_;
> - print STDERR $prompt;
> - STDERR->flush;
> - require Term::ReadKey;
> - Term::ReadKey::ReadMode('noecho');
> my $password = '';
> - while (defined(my $key = Term::ReadKey::ReadKey(0))) {
> - last if $key =~ /[\012\015]/; # \n\r
> - $password .= $key;
> + if (exists $ENV{GIT_ASKPASS}) {
> + open(PH, "$ENV{GIT_ASKPASS} \"$prompt\" |");
> + $password = <PH>;
> + $password =~ s/[\012\015]//; # \n\r
> + close(PH);
> + } else {
> + print STDERR $prompt;
> + STDERR->flush;
> + require Term::ReadKey;
> + Term::ReadKey::ReadMode('noecho');
> + while (defined(my $key = Term::ReadKey::ReadKey(0))) {
> + last if $key =~ /[\012\015]/; # \n\r
> + $password .= $key;
> + }
> + Term::ReadKey::ReadMode('restore');
> + print STDERR "\n";
> + STDERR->flush;
> }
> - Term::ReadKey::ReadMode('restore');
> - print STDERR "\n";
> - STDERR->flush;
> $password;
> }
>
> --
> 1.7.0.83.g241b9.dirty
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2010-02-23 23:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-23 11:11 [PATCH 1/1] Use GIT_ASKPASS environment to launch thirdpart UI app to get password Frank Li
2010-02-23 23:31 ` Laszlo Papp [this message]
2010-02-24 5:13 ` David Aguilar
2010-02-24 5:31 ` Junio C Hamano
2010-02-24 8:13 ` Frank Li
2010-02-25 9:15 ` David Aguilar
2010-02-25 17:15 ` Laszlo Papp
2010-02-26 0:15 ` Frank Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a362e8011002231531k17725788sb45e70428c33848b@mail.gmail.com \
--to=djszapi@archlinux.us \
--cc=git@vger.kernel.org \
--cc=lznuaa@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).