git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-svn: delay term initialization

From
EWEric Wong <normalperson@yhbt.net>
Date
Sep 14, 2014, 08:04 UTC
Message-ID
<1410681849-3107-1-git-send-email-normalperson@yhbt.net>

On my Debian 7 system, this gives 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>
---
 Also, manually tested to ensure dcommit --interactive works.
 git-svn.perl | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 40565cd..ce0d7e1 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) )
-- 
EW
Next: Eric Wong
Message 1 of 3 in “git-svn: delay term initialization”
  1. git-svn: delay term initializationEric Wong, Sep 14, 2014
  2. Eric WongSep 14, 2014
  3. Junio C HamanoSep 15, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.