1. 12 9月, 2009 1 次提交
  2. 22 1月, 2009 1 次提交
    • J
      pager: do wait_for_pager on signal death · a3da8821
      Jeff King 提交于
      Since ea27a18c (spawn pager via run_command interface), the
      original git process actually does git work, and the pager
      is a child process (actually, on Windows it has always been
      that way, since Windows lacks fork). After spawning the
      pager, we register an atexit() handler that waits for the
      pager to finish.
      
      Unfortunately, that handler does not always run. In
      particular, if git is killed by a signal, then we exit
      immediately. The calling shell then thinks that git is done;
      however, the pager is still trying to run and impact the
      terminal. The result can be seen by running a long git
      process with a pager (e.g., "git log -p") and hitting ^C.
      Depending on your config, you should see the shell prompt,
      but pressing a key causes the pager to do any terminal
      de-initialization sequence.
      
      This patch just intercepts any death-dealing signals and
      waits for the pager before dying. Under typical less
      configuration, that means hitting ^C will cause git to stop
      generating output, but the pager will keep running.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a3da8821
  3. 15 12月, 2008 1 次提交
    • J
      pager: do not dup2 stderr if it is already redirected · a8335024
      Junio C Hamano 提交于
      An earlier commit 61b80509 (sending errors to stdout under $PAGER,
      2008-02-16) avoided losing the error messages that are sent to the
      standard error when $PAGER is in effect by dup2'ing fd 2 to the pager.
      his way, showing a tag object that points to a bad object:
      
          $ git show tag-foo
      
      would give the error message to the pager.  However, it was not quite
      right if the user did:
      
          $ git show 2>error.log tag-foo
      
      i.e. use the pager but store the errors in a separate file.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a8335024
  4. 26 7月, 2008 1 次提交
    • J
      spawn pager via run_command interface · ea27a18c
      Jeff King 提交于
      This has two important effects:
      
       1. The pager is now the _child_ process, instead of the
          parent. This means that whatever spawned git (e.g., the
          shell) will see the exit code of the git process, and
          not the pager.
      
       2. The mingw and regular code are now unified, which makes
          the setup_pager function much simpler.
      
      There are two caveats:
      
       1. We used to call execlp directly on the pager, followed
          by trying to exec it via the shall. We now just use the
          shell (which is what mingw has always done). This may
          have different results for pager names which contain
          shell metacharacters.
      
          It is also slightly less efficient because we
          unnecessarily run the shell; however, pager spawning is
          by definition an interactive task, so it shouldn't be
          a huge problem.
      
       2. The git process will remain in memory while the user
          looks through the pager. This is potentially wasteful.
          We could get around this by turning the parent into a
          meta-process which spawns _both_ git and the pager,
          collects the exit status from git, waits for both to
          end, and then exits with git's exit code.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ea27a18c
  5. 26 6月, 2008 1 次提交
  6. 15 5月, 2008 1 次提交
  7. 18 2月, 2008 1 次提交
    • J
      sending errors to stdout under $PAGER · 61b80509
      Junio C Hamano 提交于
      If you do this (and you are not an Emacs user who uses PAGER=cat
      in your *shell* buffer):
      
              $ git init
              Initialized empty Git repository in .git/
              $ echo hello world >foo
              $ H=$(git hash-object -w foo)
              $ git tag -a foo-tag -m "Tags $H" $H
              $ echo $H
              3b18e512dba79e4c8300dd08aeb37f8e728b8dad
              $ rm -f .git/objects/3b/18e5*
              $ git show foo-tag
              tag foo-tag
              Tagger: Junio C Hamano <gitster@pobox.com>
              Date:   Sat Feb 16 10:43:23 2008 -0800
      
              Tags 3b18e512dba79e4c8300dd08aeb37f8e728b8dad
      
      you do not get any indication of error.  If you are careful, you
      would notice that no contents from the tagged object is
      displayed, but that is about it.  If you run the "show" command
      without pager, however, you will see the error:
      
              $ git --no-pager show foo-tag
              tag foo-tag
              Tagger: Junio C Hamano <gitster@pobox.com>
              Date:   Sat Feb 16 10:43:23 2008 -0800
      
              Tags 3b18e512dba79e4c8300dd08aeb37f8e728b8dad
              error: Could not read object 3b18e512dba79e4c8300dd08aeb37f8e728b8dad
      
      Because we spawn the pager as the foreground process and feed
      its input via pipe from the real command, we cannot affect the
      exit status the shell sees from git command when the pager is in
      use (I think there is not much gain we can have by working it
      around, though).  But at least it may make sense to show the
      error message to the user sitting in front of the pager.
      
      [jc: Edgar Toernig suggested a much nicer implementation than
      what I originally posted, which I took.]
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      61b80509
  8. 11 12月, 2007 1 次提交
    • J
      Support GIT_PAGER_IN_USE environment variable · 6e9af863
      Jeff King 提交于
      When deciding whether or not to turn on automatic color
      support, git_config_colorbool checks whether stdout is a
      tty. However, because we run a pager, if stdout is not a
      tty, we must check whether it is because we started the
      pager. This used to be done by checking the pager_in_use
      variable.
      
      This variable was set only when the git program being run
      started the pager; there was no way for an external program
      running git indicate that it had already started a pager.
      This patch allows a program to set GIT_PAGER_IN_USE to a
      true value to indicate that even though stdout is not a tty,
      it is because a pager is being used.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6e9af863
  9. 15 11月, 2007 1 次提交
  10. 07 8月, 2007 1 次提交
    • J
      pager: find out pager setting from configuration · cad3a205
      Junio C Hamano 提交于
      It was very unfortunate that we added core.pager setting to the
      configuration file; even when the underlying command does not care
      if there is no git repository is involved (think "git diff --no-index"),
      the user would now rightfully want the configuration setting to be
      honored, which means we would need to read the configuration file before
      we launch the pager.
      
      This is a minimum change in the sense that it restores the old
      behaviour of not even reading config in setup_git_directory(),
      but have the core.pager honored when we know it matters.
      
      Note that this does not cover "git -p --git-dir where command";
      the -p option immediately trigger the pager settings before we
      even see --git-dir to learn where the configuration file is, so
      we will end up reading the configuration from the place where
      we would _normally_ find the git repository.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cad3a205
  11. 05 7月, 2007 1 次提交
  12. 06 2月, 2007 1 次提交
    • L
      pager: Work around window resizing bug in 'less' · 35ce8622
      Linus Torvalds 提交于
      If you resize the terminal while less is waiting for input, less
      will exit entirely without even showing the output. This is very
      noticeable if you do something like "git diff" on a big and
      cold-cache tree and git takes a few seconds to think, and then
      you resize the window while it's preparing. Boom. No output AT
      ALL.
      
      The way to reproduce the problem is to do some pager operation
      that takes a while in git, and resizing the window while git is
      thinking about the output.  Try
      
      	git diff --stat v2.6.12..
      
      in the kernel tree to do something where it takes a while for git to start
      outputting information.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      35ce8622
  13. 23 10月, 2006 1 次提交
  14. 21 10月, 2006 1 次提交
  15. 01 8月, 2006 1 次提交
  16. 11 7月, 2006 1 次提交
  17. 09 7月, 2006 1 次提交
    • J
      "git -p cmd" to page anywhere · 85fb65ed
      Junio C Hamano 提交于
      This allows you to say:
      
      	git -p diff v2.6.16-rc5..
      
      and the command pipes the output of any git command to your pager.
      
      [jc: this resurrects a month old RFC patch with improvement
       suggested by Linus to call it --paginate instead of --less.]
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      85fb65ed
  18. 18 6月, 2006 1 次提交
  19. 22 4月, 2006 1 次提交
  20. 16 4月, 2006 2 次提交
  21. 01 3月, 2006 1 次提交