Re: To page or not to page
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 2, 2008, 18:18 UTC
- Message-ID
- <7v1w4ky3hh.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <20080502125553.GB2923@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> My bigger worry is that this affects only builtins. Which makes it > sufficient for turning off the pager for anything that does USE_PAGER.
Hmm. How about doing things this way?
- at the beginning of handle_options() remember argv[0]
- restructure handle_options() so that it does not run setup_pager() and
setenv("GIT_PAGER", "cat", 1) inside the loop, but instead remember
what we had on the command line;- after the handle_options() loop, if we saw an explicit --pager, --no-pager, that's the decision;
- otherwise:
- look at argv[0] to see what the command is;
- do the config thing to see if there is user preference; if there is
one, that setting decides;- otherwise:
- see the built-in defaults;
- and finally use or not use pager depending on what we found above.
I suspect we would want a similar restructure of handle_options() loop about --git-dir and --git-work-tree so that the loop is only used to decide what to do and action is carried out after the loop exits, but that is a separate topic.