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

Re: pager: consider revisiting automatic LESS=FRX with custom core.pager

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Sep 19, 2026, 15:48 UTC
Message-ID
<aq6utXAQA-rRoKSm@fruit.crustytoothpaste.net>
In-Reply-To
<CAKNeS+mFS_VCs_tQeFb8jBx70FwQLW0LtuqhSk4xSdbWdqDR=g@mail.gmail.com>
On 2026-09-19 at 12:19:40, Francisco Boni wrote:
> Hi,
Ney,
Show 14 quoted lines
> There is also an unintuitive distinction between:
> 
> ```
> unset LESS
> ```
> 
> and:
> 
> ```
> LESS=""
> ```
> 
> The former causes Git to inject `FRX`, while the latter causes Git to
> leave the pager environment alone.

Yes, that's because Git sets the environment iff it is unset. In the latter case, it is not unset: it is set to a zero-length value.

Show 8 quoted lines
> I realize simply removing the default could have substantial
> compatibility consequences given how longstanding this behavior is.
> But perhaps it would be worth considering whether the automatic `LESS`
> default should:
> 
> * apply only to Git's own default pager path
> * be suppressible explicitly through configuration; or
> * otherwise avoid affecting arbitrary custom `core.pager` commands.

We can't know in the general case whether the pager is less or not. On FreeBSD, `more` is less, for instance, and the pager command allows arbitrary shell commands, so determining statically which branch is taken is not always possible. Notably, Debian has `sensible-pager`, which is the default on that OS, and may (or may not) be less.

Users would be displeased if Git's pager functionality worked differently with less depending on how less was invoked or named, or if it weren't enabled in a case like the following:

    core.pager='f() { if [ "$(uname -s)" = FreeBSD ]; then more "$@"; else less "$@"; fi; };f'

A user might in fact do exactly that to make things work correctly on multiple platforms with a single gitconfig file. (This is why passing certain environment variables or options to the shell is obligatory and you cannot simply do shell parsing of the command.)

I agree that this can cause unusual behaviour in the case you've described, but that's more of the case because it's actually unusual to have commands that take arguments through the environment in this way. That's no longer really considered a good design; normally we use a config file instead these days.

I'll note that it is configurable both through the environment and through configuration, using one of the following:

    GIT_PAGER='LESS="" delta'
or:
    git config core.pager 'LESS="" delta'
or, if you prefer to be still more conservative:
    GIT_PAGER='env -i PATH="$PATH" delta'
which unsets all environment variables but the path for your pager.
> So this is not primarily a request for a workaround; rather, I wanted
> to raise the broader behavior because the interaction with pager
> wrappers is quite surprising and difficult to diagnose.

I think at this point, we're unlikely to change the behaviour and it would be a notable and unwelcome change to do so.

-- 
brian m. carlson (they/them)
Toronto, Ontario, CA
Previous: Francisco BoniNext: Todd Zullinger
Message 2 of 7 in “pager: consider revisiting automatic LESS=FRX with custom core.pager”
  1. Francisco BoniSep 19, 2026
  2. brian m. carlsonSep 19, 2026
  3. Todd ZullingerSep 19, 2026
  4. doc: add more examples of overriding LESS in core.pagerTodd Zullinger, Oct 2, 2026
  5. brian m. carlsonOct 5, 2026
  6. Junio C HamanoOct 6, 2026
  7. Francisco BoniSep 19, 2026

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.