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

git-diff should not fire up $PAGER, period!

From
jidanni@jidanni.org <jidanni@jidanni.org>
Date
Dec 17, 2008, 21:45 UTC
Message-ID
<8763lixyps.fsf_-_@jidanni.org>
In-Reply-To
<20081216005658.GB3679@coredump.intra.peff.net>
Gentlemen, I have found the solution to your problem.
Unbundle git-diff and $PAGER.
Ask yourself, does diff(1) call $PAGER?

No. That's because the Unix designers were smart enough not to glue everything together.

Now's your chance to repent, as you haven't even yet mentioned $PAGER on the git-diff man page. Yes, do mention it: "EXAMPLES: git-diff|less" I.e., the user can page the output if he feels inclined, just like any other output. I mean one already has a wallet. The bank need not give the user one every time they make a withdraw.

I mean here I am in emacs, and
-*- mode: compilation; default-directory: "...coreutils/" -*-
Compilation started at Thu Dec 18 03:15:14
git-diff
WARNING: terminal is not fully functional^M
^M-  (press RETURN)

"It's all emacs' fault for emulating a tty too well"... no, it's all your fault for gumming things together. No I don't want my cookies with obligatory milk. I'll using git-diff|cat for now instead of complaining that emacs is all wrong. Even using git-diff|cat|less is better than messing with the LESS=F bug. Repent, whippersnappers!

OK, doing test x$EMACS = xt && PAGER=cat in .bashrc. That will help for emacs' shell buffers, but not compilation mode buffers... "then just make a hook"... 13 hooks to combat one poor design choice. And one notices git-show is gummed up too.

Hmm, looking in changelogs, we see
 * Error messages used to be sent to stderr, only to get hidden,
   when $PAGER was in use.  They now are sent to stdout along
   with the command output to be shown in the $PAGER.

Well, if you had left paging to the user, no one would have blamed you for making error messages disappear, and you could have left stderr as the elders intended.

Wait, $ git-config --global core.pager "" Cool. Bye.

Previous: Stefan KarpinskiNext: Junio C Hamano
Message 6 of 13 in “git-diff should not fire up $PAGER if there is no diff”
  1. jidanni@jidanni.orgDec 16, 2008
  2. Jeff KingDec 16, 2008
  3. Stefan KarpinskiDec 16, 2008
  4. Jeff KingDec 16, 2008
  5. Stefan KarpinskiDec 16, 2008
  6. git-diff should not fire up $PAGER, period!jidanni@jidanni.org, Dec 17, 2008
  7. Junio C HamanoDec 17, 2008
  8. Linus TorvaldsDec 17, 2008
  9. Miles BaderDec 22, 2008
  10. Jeff KingDec 18, 2008
  11. Miles BaderDec 22, 2008
  12. Johannes SixtDec 22, 2008
  13. Junio C HamanoDec 22, 2008

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.