parse-options: option to let --git-completion-helper show negative form
[gitweb.git] / pager.c
diff --git a/pager.c b/pager.c
index 4dd9e1b26592bd3e7a7ddb52182ea79971557db0..226828f178a0c1a876710326634e83288863af3d 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -109,10 +109,15 @@ void setup_pager(void)
                return;
 
        /*
-        * force computing the width of the terminal before we redirect
-        * the standard output to the pager.
+        * After we redirect standard output, we won't be able to use an ioctl
+        * to get the terminal size. Let's grab it now, and then set $COLUMNS
+        * to communicate it to any sub-processes.
         */
-       (void) term_columns();
+       {
+               char buf[64];
+               xsnprintf(buf, sizeof(buf), "%d", term_columns());
+               setenv("COLUMNS", buf, 0);
+       }
 
        setenv("GIT_PAGER_IN_USE", "true", 1);
 
@@ -194,7 +199,7 @@ static int pager_command_config(const char *var, const char *value, void *vdata)
        const char *cmd;
 
        if (skip_prefix(var, "pager.", &cmd) && !strcmp(cmd, data->cmd)) {
-               int b = git_config_maybe_bool(var, value);
+               int b = git_parse_maybe_bool(value);
                if (b >= 0)
                        data->want = b;
                else {