Skip to content

Commit 190c1cd

Browse files
jrngitster
authored andcommitted
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 <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 06300d9 commit 190c1cd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

git-svn.perl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5459,15 +5459,20 @@ sub git_svn_log_cmd {
54595459

54605460
# adapted from pager.c
54615461
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)));
54635468
if ($pager eq 'cat') {
54645469
$pager = undef;
54655470
}
54665471
$ENV{GIT_PAGER_IN_USE} = defined($pager);
54675472
}
54685473

54695474
sub run_pager {
5470-
return unless -t *STDOUT && defined $pager;
5475+
return unless defined $pager;
54715476
pipe my ($rfd, $wfd) or return;
54725477
defined(my $pid = fork) or ::fatal "Can't fork: $!";
54735478
if (!$pid) {

0 commit comments

Comments
 (0)