Merge branch 'jn/maint-fix-pager' into maint
authorJunio C Hamano <gitster@pobox.com>
Fri, 5 Mar 2010 06:27:04 +0000 (22:27 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 5 Mar 2010 06:27:04 +0000 (22:27 -0800)
* 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

1  2 
Documentation/git.txt
git-am.sh
git-sh-setup.sh
diff --combined Documentation/git.txt
index cc32ce18d213ab5e986df90b0b23a7eb79226c39,f26641a5f4157907fd2e14b97d4a1050116e3e9a..98b6e169827e91ced62af86694dba556819ac3a4
@@@ -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.<cmd>`
+       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 ebfbee59d3dda5ba8a11e35f697e8e48d2565698,b11af03e0b47f248304adfe4317949da92196388..9df951a597d6b9ec5f7f390c35a60adb942a3fdc
+++ 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
        go_next
  done
  
 -git gc --auto
 -
  rm -fr "$dotest"
 +git gc --auto
diff --combined git-sh-setup.sh
index 5e22440aecc4aa57455ce836624f5fe17b6d1f73,44fb4670aed97fb4eebc2c8985dff9c363732507..7a095665d71f153a970243a9d03d919ddef29c88
@@@ -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."
  }