From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Kevin Ballard <kevin@sb.org>, Git Mailing List <git@vger.kernel.org>
Subject: Re: To page or not to page
Date: Mon, 5 May 2008 17:59:25 -0400 [thread overview]
Message-ID: <20080505215924.GA9228@sigill.intra.peff.net> (raw)
In-Reply-To: <7v1w4ky3hh.fsf@gitster.siamese.dyndns.org>
On Fri, May 02, 2008 at 11:18:02AM -0700, Junio C Hamano wrote:
> 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.
OK, that makes some sense. I think some of what you describe is just
refactoring (e.g., it doesn't matter if we actually do things when we
see --no-pager or afterwards, since it always takes precedence). The key
things are:
- work not just on running builtins, but before we even figure out
whether we have a builtin or a script
- in my patch the config just says "ignore the default USE_PAGER", but
it really should be "turn off the pager via GIT_PAGER=cat". That way
you can say pager.stash = false, and it will impact the git-diff
invocation run by stash.
But that isn't to say the refactoring isn't worth doing to keep things
clean. I will take a stab at restructuring it the way you specified.
There is one remaining annoyance, though: this code is only run via the
git wrapper. That means that you will get different behavior for
"git-stash" versus "git stash". To make that work, we would have to put
equivalent support into each script (although we could hit several at
once with git-sh-setup.sh) and each non-builtin.
-Peff
next prev parent reply other threads:[~2008-05-05 22:00 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-02 5:41 To page or not to page Kevin Ballard
2008-05-02 5:45 ` Jeff King
2008-05-02 5:56 ` Junio C Hamano
2008-05-02 6:04 ` Kevin Ballard
2008-05-02 6:08 ` Junio C Hamano
2008-05-02 13:47 ` Bart Trojanowski
2008-05-02 9:41 ` Pedro Melo
2008-05-02 16:58 ` Kevin Ballard
2008-05-02 10:34 ` Wincent Colaiuta
2008-05-02 12:36 ` Jeff King
2008-05-02 13:49 ` Pedro Melo
2008-05-02 14:00 ` Aidan Van Dyk
2008-05-02 16:13 ` Wincent Colaiuta
2008-05-02 16:56 ` Kevin Ballard
2008-05-02 18:40 ` Wincent Colaiuta
2008-05-02 6:11 ` Jeff King
2008-05-02 7:53 ` Johannes Schindelin
2008-05-02 6:09 ` Jeff King
2008-05-02 6:19 ` Junio C Hamano
2008-05-02 12:55 ` Jeff King
2008-05-02 18:18 ` Junio C Hamano
2008-05-05 21:59 ` Jeff King [this message]
2008-05-06 5:51 ` Jeff King
2008-05-06 5:53 ` Jeff King
2008-05-11 17:15 ` Junio C Hamano
2008-05-16 4:42 ` Jeff King
2008-05-16 4:51 ` Jeff King
2008-05-16 10:29 ` Johannes Schindelin
2008-05-02 6:56 ` Jakub Narebski
2008-05-02 12:57 ` Jeff King
2008-05-02 15:36 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080505215924.GA9228@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kevin@sb.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).