From: Junio C Hamano Date: Tue, 2 Mar 2010 20:44:11 +0000 (-0800) Subject: Merge branch 'jn/maint-fix-pager' X-Git-Tag: v1.7.1-rc0~106 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/52ebb06f1466a235c643acffdea9c9e484cfdec0?hp=-c Merge branch 'jn/maint-fix-pager' * jn/maint-fix-pager: tests: Fix race condition in t7006-pager t7006-pager: if stdout is not a terminal, make a new one tests: Add tests for automatic use of pager am: Fix launching of pager git svn: Fix launching of pager git.1: Clarify the behavior of the --paginate option Make 'git var GIT_PAGER' always print the configured pager Fix 'git var' usage synopsis --- 52ebb06f1466a235c643acffdea9c9e484cfdec0 diff --combined Documentation/git.txt index cc32ce18d2,f26641a5f4..98b6e16982 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@@ -43,10 -43,9 +43,10 @@@ unreleased) version of git, that is ava branch of the `git.git` repository. Documentation for older releases are available here: -* link:v1.7.0/git.html[documentation for release 1.7.0] +* link:v1.7.0.1/git.html[documentation for release 1.7.0.1] * release notes for + link:RelNotes-1.7.0.1.txt[1.7.0.1], link:RelNotes-1.7.0.txt[1.7.0]. * link:v1.6.6.2/git.html[documentation for release 1.6.6.2] @@@ -230,7 -229,10 +230,10 @@@ help ...` -p:: --paginate:: - Pipe all output into 'less' (or if set, $PAGER). + Pipe all output into 'less' (or if set, $PAGER) if standard + output is a terminal. This overrides the `pager.` + configuration options (see the "Configuration Mechanism" section + below). --no-pager:: Do not pipe git output into a pager. @@@ -402,7 -404,8 +405,8 @@@ people. Here is an example ------------ Various commands read from the configuration file and adjust - their operation accordingly. + their operation accordingly. See linkgit:git-config[1] for a + list. Identifier Terminology diff --combined git-am.sh index ebfbee59d3,b11af03e0b..9df951a597 --- a/git-am.sh +++ b/git-am.sh @@@ -663,10 -663,7 +663,7 @@@ d [eE]*) git_editor "$dotest/final-commit" action=again ;; [vV]*) action=again - : ${GIT_PAGER=$(git var GIT_PAGER)} - : ${LESS=-FRSX} - export LESS - $GIT_PAGER "$dotest/patch" ;; + git_pager "$dotest/patch" ;; *) action=again ;; esac done @@@ -776,5 -773,6 +773,5 @@@ go_next done -git gc --auto - rm -fr "$dotest" +git gc --auto diff --combined git-sh-setup.sh index 5e22440aec,44fb4670ae..7a095665d7 mode 100644,100755..100644 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@@ -107,6 -107,19 +107,19 @@@ git_editor() eval "$GIT_EDITOR" '"$@"' } + git_pager() { + if test -t 1 + then + GIT_PAGER=$(git var GIT_PAGER) + else + GIT_PAGER=cat + fi + : ${LESS=-FRSX} + export LESS + + eval "$GIT_PAGER" '"$@"' + } + sane_grep () { GREP_OPTIONS= LC_ALL=C grep "$@" } @@@ -128,7 -141,7 +141,7 @@@ cd_to_toplevel () } require_work_tree () { - test $(git rev-parse --is-inside-work-tree) = true || + test "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = true || die "fatal: $0 cannot be used without a working tree." } diff --combined git-svn.perl index 49dd649bc5,473a0b9d55..b7c03b641c --- a/git-svn.perl +++ b/git-svn.perl @@@ -36,13 -36,11 +36,13 @@@ $ENV{TZ} = 'UTC' $| = 1; # unbuffer STDOUT sub fatal (@) { print STDERR "@_\n"; exit 1 } -require SVN::Core; # use()-ing this causes segfaults for me... *shrug* -require SVN::Ra; -require SVN::Delta; -if ($SVN::Core::VERSION lt '1.1.0') { - fatal "Need SVN::Core 1.1.0 or better (got $SVN::Core::VERSION)"; +sub _req_svn { + require SVN::Core; # use()-ing this causes segfaults for me... *shrug* + require SVN::Ra; + require SVN::Delta; + if ($SVN::Core::VERSION lt '1.1.0') { + fatal "Need SVN::Core 1.1.0 or better (got $SVN::Core::VERSION)"; + } } my $can_compress = eval { require Compress::Zlib; 1}; push @Git::SVN::Ra::ISA, 'SVN::Ra'; @@@ -732,8 -730,6 +732,8 @@@ sub cmd_branch $src=~s/^http:/https:/; } + ::_req_svn(); + my $ctx = SVN::Client->new( auth => Git::SVN::Ra::_auth_providers(), log_msg => sub { @@@ -3277,7 -3273,7 +3277,7 @@@ sub find_extra_svn_parents "$new_parents[$i]..$new_parents[$j]", ); if ( !$revs ) { - undef($new_parents[$i]); + undef($new_parents[$j]); } } } @@@ -4863,8 -4859,6 +4863,8 @@@ sub new $url =~ s!/+$!!; return $RA if ($RA && $RA->{url} eq $url); + ::_req_svn(); + SVN::_Core::svn_config_ensure($config_dir, undef); my ($baton, $callbacks) = SVN::Core::auth_open_helper(_auth_providers); my $config = SVN::Core::config_get_config($config_dir); @@@ -5465,7 -5459,12 +5465,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; } @@@ -5473,7 -5472,7 +5478,7 @@@ } 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) {