From: Junio C Hamano Date: Fri, 5 Mar 2010 06:27:04 +0000 (-0800) Subject: Merge branch 'jn/maint-fix-pager' into maint X-Git-Tag: v1.7.0.2~6 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/6914c661c3652e22fc2971bfefd36fddad56233a?ds=inline;hp=-c Merge branch 'jn/maint-fix-pager' into maint * 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 --- 6914c661c3652e22fc2971bfefd36fddad56233a 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 --- 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." }