Merge branch 'jc/unexport-git-pager-in-use-in-pager'
authorJunio C Hamano <gitster@pobox.com>
Mon, 13 Jul 2015 21:00:26 +0000 (14:00 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Jul 2015 21:00:27 +0000 (14:00 -0700)
When you say "!<ENTER>" while running say "git log", you'd confuse
yourself in the resulting shell, that may look as if you took
control back to the original shell you spawned "git log" from but
that isn't what is happening. To that new shell, we leaked
GIT_PAGER_IN_USE environment variable that was meant as a local
communication between the original "Git" and subprocesses that was
spawned by it after we launched the pager, which caused many
"interesting" things to happen, e.g. "git diff | cat" still paints
its output in color by default.

Stop leaking that environment variable to the pager's half of the
fork; we only need it on "Git" side when we spawn the pager.

* jc/unexport-git-pager-in-use-in-pager:
pager: do not leak "GIT_PAGER_IN_USE" to the pager

1  2 
pager.c
diff --combined pager.c
index 98b26823c9e0c0bd220a7a41a97675626c8e65ec,d40288b3e4c2574e6f05597efd1bc355c2a8593a..070dc11cb0c85abf07763de46a82e73dde6bded2
+++ b/pager.c
@@@ -78,6 -78,7 +78,7 @@@ void setup_pager(void
                argv_array_push(&pager_process.env_array, "LESS=FRX");
        if (!getenv("LV"))
                argv_array_push(&pager_process.env_array, "LV=-c");
+       argv_array_push(&pager_process.env_array, "GIT_PAGER_IN_USE");
        if (start_command(&pager_process))
                return;
  
@@@ -133,12 -134,12 +134,12 @@@ int term_columns(void
  /*
   * How many columns do we need to show this number in decimal?
   */
 -int decimal_width(int number)
 +int decimal_width(uintmax_t number)
  {
 -      int i, width;
 +      int width;
  
 -      for (width = 1, i = 10; i <= number; width++)
 -              i *= 10;
 +      for (width = 1; number >= 10; width++)
 +              number /= 10;
        return width;
  }