summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2014-09-14 07:38:29 +0000
committerEric Wong <normalperson@yhbt.net>2014-09-14 08:08:54 +0000
commit30d45f798d1a4b14759cd977b68be4476d66ea17 (patch)
treef43a4d2b868f15f2bd5211876124c9665927c0b0
parenta831a3fd86bb7280020d650d52cce4af9e161c46 (diff)
downloadgit-30d45f798d1a4b14759cd977b68be4476d66ea17.tar.gz
git-svn: delay term initialization
On my Debian 7 system, this fixes annoying warnings when the output of "git svn" commands are redirected: Unable to get Terminal Size. The TIOCGWINSZ ioctl didn't work. The COLUMNS and LINES environment variables didn't work. The resize program didn't work. Signed-off-by: Eric Wong <normalperson@yhbt.net>
-rwxr-xr-xgit-svn.perl18
1 files changed, 11 insertions, 7 deletions
diff --git a/git-svn.perl b/git-svn.perl
index 97ff562843..b6e2186cef 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -306,13 +306,16 @@ sub readline {
}
package main;
-my $term = eval {
- $ENV{"GIT_SVN_NOTTY"}
- ? new Term::ReadLine 'git-svn', \*STDIN, \*STDOUT
- : new Term::ReadLine 'git-svn';
-};
-if ($@) {
- $term = new FakeTerm "$@: going non-interactive";
+my $term;
+sub term_init {
+ $term = eval {
+ $ENV{"GIT_SVN_NOTTY"}
+ ? new Term::ReadLine 'git-svn', \*STDIN, \*STDOUT
+ : new Term::ReadLine 'git-svn';
+ };
+ if ($@) {
+ $term = new FakeTerm "$@: going non-interactive";
+ }
}
my $cmd;
@@ -424,6 +427,7 @@ sub ask {
my $default = $arg{default};
my $resp;
my $i = 0;
+ term_init() unless $term;
if ( !( defined($term->IN)
&& defined( fileno($term->IN) )