setup.c: re-fix d95138e (setup: set env $GIT_WORK_TREE when ..
[gitweb.git] / pager.c
diff --git a/pager.c b/pager.c
index 98b26823c9e0c0bd220a7a41a97675626c8e65ec..27d4c8a17aa17bb2cf31484227073e1a3204c17f 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -78,6 +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;
 
@@ -149,7 +150,8 @@ int check_pager_config(const char *cmd)
        struct strbuf key = STRBUF_INIT;
        const char *value = NULL;
        strbuf_addf(&key, "pager.%s", cmd);
-       if (!git_config_get_value(key.buf, &value)) {
+       if (git_config_key_is_valid(key.buf) &&
+           !git_config_get_value(key.buf, &value)) {
                int b = git_config_maybe_bool(key.buf, value);
                if (b >= 0)
                        want = b;