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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 20, 2013, 17:33 UTC
Message-ID
<xmqqob5f6krn.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CABPQNSb6PD+oSw_LT6KaUYd8BTeN-WHJFodcuiLe=u76rFYFJw@mail.gmail.com>
Erik Faye-Lund <kusmabite@gmail.com> writes:
Show 34 quoted lines
>> ...
>> is set to empty., 2006-04-16). At that time, the line
>> directly above used:
>>
>>    if (!pager)
>>            pager = "less";
>>
>> as a fallback, meaning that it could not possibly trigger
>> the optimization. Later, a3d023d (Provide a build time
>> default-pager setting, 2009-10-30) turned that constant into
>> a build-time setting which could be anything, but didn't
>> loosen the "else" to let DEFAULT_PAGER use the optimization.
>>
>> Noticed-by: Dale R. Worley <worley@alum.mit.edu>
>> Suggested-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
>> Signed-off-by: Jeff King <peff@peff.net>
>> ---
>>  pager.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> 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?

If you have been running "GIT_PAGER=cat git whatever" and the like, we did not pipe the output through "cat" and this has been the case for a long time. The only thing the patch in question changed is for those who build with

	make DEFAULT_PAGER=cat

and I doubt that you have been debugging git by rebuilding it with such a setting, so....

Previous: Erik Faye-LundNext: Erik Faye-Lund
Message 14 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.