]> git.ipfire.org Git - thirdparty/git.git/blobdiff - pager.c
fast-import: introduce "feature notes" command
[thirdparty/git.git] / pager.c
diff --git a/pager.c b/pager.c
index 92c03f654abd0333bd0dd48b4aebf9ae42ac4de5..dac358f047550a07dd8d90b2e410feab3eebd534 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -28,7 +28,7 @@ static void pager_preexec(void)
 }
 #endif
 
-static const char *pager_argv[] = { "sh", "-c", NULL, NULL };
+static const char *pager_argv[] = { NULL, NULL };
 static struct child_process pager_process;
 
 static void wait_for_pager(void)
@@ -48,11 +48,11 @@ static void wait_for_pager_signal(int signo)
        raise(signo);
 }
 
-const char *git_pager(void)
+const char *git_pager(int stdout_is_tty)
 {
        const char *pager;
 
-       if (!isatty(1))
+       if (!stdout_is_tty)
                return NULL;
 
        pager = getenv("GIT_PAGER");
@@ -73,7 +73,7 @@ const char *git_pager(void)
 
 void setup_pager(void)
 {
-       const char *pager = git_pager();
+       const char *pager = git_pager(isatty(1));
 
        if (!pager)
                return;
@@ -81,7 +81,8 @@ void setup_pager(void)
        spawned_pager = 1; /* means we are emitting to terminal */
 
        /* spawn the pager */
-       pager_argv[2] = pager;
+       pager_argv[0] = pager;
+       pager_process.use_shell = 1;
        pager_process.argv = pager_argv;
        pager_process.in = -1;
        if (!getenv("LESS")) {