summaryrefslogtreecommitdiff
path: root/pager.c
diff options
context:
space:
mode:
Diffstat (limited to 'pager.c')
-rw-r--r--pager.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/pager.c b/pager.c
index fb7a1a625a..0376953cb1 100644
--- a/pager.c
+++ b/pager.c
@@ -5,6 +5,8 @@
* something different on Windows, for example.
*/
+static int spawned_pager;
+
static void run_pager(const char *pager)
{
/*
@@ -41,7 +43,7 @@ void setup_pager(void)
else if (!*pager || !strcmp(pager, "cat"))
return;
- pager_in_use = 1; /* means we are emitting to terminal */
+ spawned_pager = 1; /* means we are emitting to terminal */
if (pipe(fd) < 0)
return;
@@ -70,3 +72,14 @@ void setup_pager(void)
die("unable to execute pager '%s'", pager);
exit(255);
}
+
+int pager_in_use(void)
+{
+ const char *env;
+
+ if (spawned_pager)
+ return 1;
+
+ env = getenv("GIT_PAGER_IN_USE");
+ return env ? git_config_bool("GIT_PAGER_IN_USE", env) : 0;
+}