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

Re: [PATCH] Revert "Stop starting pager recursively"

From
JEJörn Engel <joern@logfs.org>
Date
Apr 25, 2014, 20:10 UTC
Message-ID
<20140425201048.GB29904@logfs.org>
In-Reply-To
<vpqoazpdz1r.fsf@anie.imag.fr>
On Fri, 25 April 2014 20:49:52 +0200, Matthieu Moy wrote:
Show 24 quoted lines
> Jörn Engel <joern@logfs.org> writes:
> > On Mon, 21 April 2014 16:46:22 -0400, Jörn Engel wrote:
> >> 
> >> This reverts commit 88e8f908f2b0c56f9ccf8134d8ff9f689af9cc84.
> >> 
> >> Caused a usability regression for me and foul language for my coworkers.
> >
> > Ping.
> 
> How do you solve the problem that the commit you revert was solving? The
> commit you propose to revert says in its message:
> 
>     git-column can be used as a pager for other git commands, something
>     like this:
>     
>         GIT_PAGER="git -p column --mode='dense color'" git -p branch
>     
>     The problem with this is that "git -p column" also has $GIT_PAGER set so
>     the pager runs itself again as another pager. The end result is an
>     infinite loop of forking.
> 
> There's probably a solution, but you can't ignore the problem (or
> someone else will later try to solve the infinite loop and revert your
> commit, and so on ...).
Disclaimer: I never looked at git internals before this regression
forced me to and am likely talking out of my arse.

One approach is "don't do that then". Someone explicitly changed the git pager to be git, which itself takes the git pager, etc. That is asking for infinite recursion and the original problem was that git gave the user exactly what they asked for.

A second option is to add a --pager (or rather --no-pager) option to
the command line and allow the user to specify
    GIT_PAGER="git --no-pager -p column --mode='dense color'" git -p branch

A third option is to try to be smart and give the user what he wants, not what he asked for. If the pager happens to be git, unset $GIT_PAGER, $PAGER and somehow disable core.pager. Yeah, that will turn nasty rather quickly.

A fourth option is to set an environment variable for the pager process itself. Disable paging similar to the original patch, but make it conditional on we_are_the_pager(), not pager_in_use().

My preference is option four, but see disclaimer above.
Jörn

-- I've never met a human being who would want to read 17,000 pages of documentation, and if there was, I'd kill him to get him out of the gene pool. -- Joseph Costello

Previous: Matthieu MoyNext: Jeff King
Message 4 of 13 in “Revert "Stop starting pager recursively"”
  1. Revert "Stop starting pager recursively"Jörn Engel, Apr 21, 2014
  2. Jörn EngelApr 25, 2014
  3. Matthieu MoyApr 25, 2014
  4. Jörn EngelApr 25, 2014
  5. Jeff KingApr 26, 2014
  6. Junio C HamanoApr 26, 2014
  7. Jeff KingApr 26, 2014
  8. Duy NguyenApr 27, 2014
  9. Jeff KingApr 27, 2014
  10. Matthieu MoyApr 27, 2014
  11. Jörn EngelApr 28, 2014
  12. Junio C HamanoApr 28, 2014
  13. Jörn EngelApr 28, 2014

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.