git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] pager: turn on "cat" optimization for DEFAULT_PAGER

From
Erik Faye-Lund <kusmabite@gmail.com>
Date
Nov 20, 2013, 17:33 UTC
Message-ID
<CABPQNSYWntx_36kTB4GG4i+m8tXn4k+YSDEWn9KZU-9t6xCAXQ@mail.gmail.com>
In-Reply-To
<20131120173054.GA15339@sigill.intra.peff.net>
On Wed, Nov 20, 2013 at 6:30 PM, Jeff King <peff@peff.net> wrote:
Show 34 quoted lines
> On Wed, Nov 20, 2013 at 06:24:45PM +0100, Erik Faye-Lund wrote:
>
>> > diff --git a/pager.c b/pager.c
>> > index c1ecf65..fa19765 100644
>> > --- a/pager.c
>> > +++ b/pager.c
>> > @@ -54,7 +54,7 @@ const char *git_pager(int stdout_is_tty)
>> >                 pager = getenv("PAGER");
>> >         if (!pager)
>> >                 pager = DEFAULT_PAGER;
>> > -       else if (!*pager || !strcmp(pager, "cat"))
>> > +       if (!*pager || !strcmp(pager, "cat"))
>>
>> Hmmpf. It's sometimes useful to actually pipe through cat rather than
>> disabling the pager, as this changes the return-code from isatty. I
>> sometimes use this for debugging-purposes. Does this patch break that?
>
> My patch should not change the behavior of PAGER=cat, GIT_PAGER=cat,
> core.pager, etc. It should _only_ impact the case where DEFAULT_PAGER is
> set to "cat" (or NULL), and bring it in line with the other cases.
>
> I am not clear on how you are using "cat", so I can't say whether it is
> broken. But if you are doing:
>
>   PAGER=cat git log
>
> that already is a no-op, and that is not changed by my patch. If you
> want to make stdout not a tty, I'd think:
>
>   git log | cat
>
> is the right way to do it (and anyway, when the pager is in effect git
> will pretend that stdout is a tty, since you would still want things
> like auto-color to go to the pager).

You are of course right. Explicitly piping through cat is plenty fine for my purposes, sorry for disturbing you.

Previous: Jeff KingNext: Junio C Hamano
Message 13 of 18 in “the pager”
  1. Dale R. WorleyAug 26, 2013
  2. Junio C HamanoAug 27, 2013
  3. Dale R. WorleyAug 28, 2013
  4. Junio C HamanoAug 28, 2013
  5. Dale R. WorleyAug 29, 2013
  6. Matthieu MoyAug 29, 2013
  7. Dale R. WorleySep 3, 2013
  8. Jonathan NiederSep 3, 2013
  9. pager: turn on "cat" optimization for DEFAULT_PAGERJeff King, Sep 3, 2013
  10. Junio C HamanoSep 3, 2013
  11. Erik Faye-LundNov 20, 2013
  12. Jeff KingNov 20, 2013
  13. Erik Faye-LundNov 20, 2013
  14. Junio C HamanoNov 20, 2013
  15. Erik Faye-LundNov 20, 2013
  16. Jeff KingSep 3, 2013
  17. Dale R. WorleySep 3, 2013
  18. Jeff KingSep 3, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.