]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Stop starting pager recursively
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Fri, 13 Apr 2012 10:54:34 +0000 (17:54 +0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 27 Apr 2012 16:26:38 +0000 (09:26 -0700)
git-column can be used as a pager for other git commands, something
like this:

    GIT_PAGER="git -p column --mode='dense color'" git -p branch

The problem with this is that "git -p column" also has $GIT_PAGER set so
the pager runs itself again as another pager. The end result is an
infinite loop of forking. Other git commands have the same problem if
being abused this way.

Check if $GIT_PAGER is already set and stop launching another pager.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pager.c

diff --git a/pager.c b/pager.c
index 05584dead6728ceff818630fbccaa91bb6c6b686..4dcb08d9674c252cbe2c2725f92eca2a0350dc93 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -73,7 +73,7 @@ void setup_pager(void)
 {
        const char *pager = git_pager(isatty(1));
 
-       if (!pager)
+       if (!pager || pager_in_use())
                return;
 
        /*