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

Re: [RFC PATCH] diff --no-index: test for pager after option parsing

From
Jeff King <peff@peff.net>
Date
Jan 7, 2009, 06:42 UTC
Message-ID
<20090107064248.GC22616@coredump.intra.peff.net>
In-Reply-To
<20090107032013.GO21154@genesis.frugalware.org>
On Wed, Jan 07, 2009 at 04:20:13AM +0100, Miklos Vajna wrote:
Show 6 quoted lines
> On Tue, Jan 06, 2009 at 04:09:18PM -0800, Junio C Hamano <gitster@pobox.com> wrote:
> > But I wonder if it still makes a difference in real life.idn't we stop
> > reporting the exit status from the pager some time ago?
> 
> I just wanted to write this, I think that code could be just removed
> since ea27a18 (spawn pager via run_command interface, 2008-07-22).

I don't think just removing it is right. You would also need to put SETUP_PAGER into the flags for calling cmd_diff.

We do pass along the error code properly these days, but I think it is nice that --exit-code always just suppresses the pager. Otherwise a script like this:

  if git diff --exit-code $x $y; then
    do something
  fi

will invoke the pager (and not everybody's setup immediately exits if there is no output, either because they have different LESS options or because they use a different pager). Of course one might argue that the script should not be using "git diff" porcelain at all, but I don't think there is another way to get a --no-index diff.

-Peff
Previous: Miklos VajnaNext: Junio C Hamano
Message 5 of 8 in “diff --no-index: test for pager after option parsing”
  1. diff --no-index: test for pager after option parsingThomas Rast, Jan 6, 2009
  2. Thomas RastJan 7, 2009
  3. Junio C HamanoJan 7, 2009
  4. Miklos VajnaJan 7, 2009
  5. Jeff KingJan 7, 2009
  6. Junio C HamanoJan 7, 2009
  7. diff --no-index -q: fix endless loopThomas Rast, Jan 7, 2009
  8. Junio C HamanoJan 7, 2009

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.