diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2010-02-14 06:06:10 -0600 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-02-14 18:23:17 -0800 |
commit | 190c1cda7eb6dc03be80f45d3d174c313d23da2c (patch) | |
tree | 09e0a5d856e692958e99a01fb5e1a57241999647 | |
parent | 06300d9753349a83212360445d241d70a46375fa (diff) | |
download | git-190c1cda7eb6dc03be80f45d3d174c313d23da2c.tar.gz git-190c1cda7eb6dc03be80f45d3d174c313d23da2c.tar.xz |
git svn: Fix launching of pager
In commit dec543e (am -i, git-svn: use "git var GIT_PAGER"), I tried
to teach git svn to defer to git var on what pager to use. In the
process, I introduced two bugs:
- The value set for $pager in config_pager has local scope, so
run_pager never sees it;
- git var cannot tell whether git svn’s output is going to a
terminal, so the value chosen for $pager does not reflect that
information.
Fix them.
Reported-by: Sebastian Celis <sebastian@sebastiancelis.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-x | git-svn.perl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/git-svn.perl b/git-svn.perl index 265852f45..473a0b9d5 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -5459,7 +5459,12 @@ sub git_svn_log_cmd { # adapted from pager.c sub config_pager { - chomp(my $pager = command_oneline(qw(var GIT_PAGER))); + if (! -t *STDOUT) { + $ENV{GIT_PAGER_IN_USE} = 'false'; + $pager = undef; + return; + } + chomp($pager = command_oneline(qw(var GIT_PAGER))); if ($pager eq 'cat') { $pager = undef; } @@ -5467,7 +5472,7 @@ sub config_pager { } sub run_pager { - return unless -t *STDOUT && defined $pager; + return unless defined $pager; pipe my ($rfd, $wfd) or return; defined(my $pid = fork) or ::fatal "Can't fork: $!"; if (!$pid) { |