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>
Jonathan Nieder committed
Feb 14, 2010 at 06:06 UTC
190c1cda7eb6dc03be80f45d3d174c313d23da2c
1 file changed
+7
-2
git-svn.perl
+7
-2
@@ -5459,7 +5459,12 @@ sub git_svn_log_cmd {
5459
5460
# adapted from pager.c
5461
sub config_pager {
5462
- chomp(my $pager = command_oneline(qw(var GIT_PAGER)));
5462
+ if (! -t *STDOUT) {
5463
+ $ENV{GIT_PAGER_IN_USE} = 'false';
5464
+ $pager = undef;
5465
+ return;
5466
+ }
5467
+ chomp($pager = command_oneline(qw(var GIT_PAGER)));
5468
if ($pager eq 'cat') {
5469
$pager = undef;
5470
}
@@ -5467,7 +5472,7 @@ sub config_pager {
5472
}
5473
5474
sub run_pager {
5470
- return unless -t *STDOUT && defined $pager;
5475
+ return unless defined $pager;
5476
pipe my ($rfd, $wfd) or return;
5477
defined(my $pid = fork) or ::fatal "Can't fork: $!";
5478
if (!$pid) {