fetch: Speed up fetch of large numbers of refs
[gitweb.git] / pager.c
diff --git a/pager.c b/pager.c
index 4921843577e42b774457a61277b9bc3441d3ab6b..f416d38ac26042d7ed6dbf87f21bf5339e481a2e 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -21,8 +21,6 @@ static void pager_preexec(void)
        FD_ZERO(&in);
        FD_SET(0, &in);
        select(1, &in, NULL, &in, NULL);
-
-       setenv("LESS", "FRSX", 0);
 }
 #endif
 
@@ -70,6 +68,10 @@ void setup_pager(void)
        pager_argv[2] = pager;
        pager_process.argv = pager_argv;
        pager_process.in = -1;
+       if (!getenv("LESS")) {
+               static const char *env[] = { "LESS=FRSX", NULL };
+               pager_process.env = env;
+       }
 #ifndef __MINGW32__
        pager_process.preexec_cb = pager_preexec;
 #endif