@matheusbsbs / matheus-bagliano / commits / c27d205aae
Fork 0

pager: environment variable GIT_PAGER to override PAGER

Signed-off-by: Matthias Lederhofer <matled@gmx.net> Signed-off-by: Junio C Hamano <junkio@cox.net>

Matthias Lederhofer committed Jul 31, 2006 at 15:27 UTC c27d205aaefb654c12a4ab9e0b4fae1882c0fc70
2 files changed +6 -1
Documentation/git.txt
+3
@@ -627,6 +627,9 @@ git Diffs
627
628 other
629 ~~~~~
630 +'GIT_PAGER'::
631 + This environment variable overrides `$PAGER`.
632 +
633 'GIT_TRACE'::
634 If this variable is set git will print `trace:` messages on
635 stderr telling about alias expansion, built-in command
pager.c
+3 -1
@@ -15,10 +15,12 @@ void setup_pager(void)
15 {
16 pid_t pid;
17 int fd[2];
18 - const char *pager = getenv("PAGER");
18 + const char *pager = getenv("GIT_PAGER");
19
20 if (!isatty(1))
21 return;
22 + if (!pager)
23 + pager = getenv("PAGER");
24 if (!pager)
25 pager = "less";
26 else if (!*pager || !strcmp(pager, "cat"))