Subject: [PATCH] honour GIT_ASKPASS for querying username in git-svn

From: Sven Strickroth <[email-masked]>
Date: Thu, 17 Nov 2011 16:15:20 +0100

>>From 8e576705ca949c32ff22d3216006073ee70652eb Mon Sep 17 00:00:00 2001
From: Sven Strickroth <[email-masked]>
Date: Thu, 17 Nov 2011 15:43:25 +0100
Subject: [PATCH 1/2] honour GIT_ASKPASS for querying username

git-svn reads usernames from an interactive terminal.
This behavior cause GUIs to hang waiting for git-svn to
complete (http://code.google.com/p/tortoisegit/issues/detail?id=967).

Also see commit 56a853b62c0ae7ebaad0a7a0a704f5ef561eb795.

Signed-off-by: Sven Strickroth <[email-masked]>
---
 git-svn.perl |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index e30df22..8ec3dfc 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -4403,6 +4403,11 @@ sub username {
 	my $username;
 	if (defined $_username) {
 		$username = $_username;
+	} else if (exists $ENV{GIT_ASKPASS}) {
+		open(PH, "-|", $ENV{GIT_ASKPASS}, "Username: ");
+		$username = <PH>;
+		$username =~ s/[\012\015]//; # \n\r
+		close(PH);
 	} else {
 		print STDERR "Username: ";
 		STDERR->flush;
-- 
1.7.7.1.msysgit.0

-- 
Best regards,
 Sven Strickroth