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

Re: [PATCH] fix color.pager = false with "git diff"

From
Jeff King <peff@peff.net>
Date
Oct 22, 2010, 01:49 UTC
Message-ID
<20101022014907.GA30532@sigill.intra.peff.net>
In-Reply-To
<7vzku7rwcv.fsf@alter.siamese.dyndns.org>
On Thu, Oct 21, 2010 at 03:53:36PM -0700, Junio C Hamano wrote:
Show 20 quoted lines
> > Original discussion here:
> >
> >   http://thread.gmane.org/gmane.comp.version-control.git/89599
> >
> > I have mixed feelings on this one. It's kind of a hack. A more elegant
> > solution would be totally rewriting the color code to check for the
> > pager at first output.
> >
> > In favor of this patch:
> >
> >   1. It fixes a real bug.
> >
> >   2. Perfect is the enemy of the good, and I don't care enough about
> >      this case to refactor the color code.
> 
> Hmm, with "[color] pager = false", what should
> 
>     $ git diff --color
> 
> do?

Ugh. It should definitely turn color on, which my patch breaks. And there's currently no way to know at that point in the code whether the COLOR_DIFF bit came from --color or from the config.

So we would need to start keeping that information through the callchain, or we need to refactor the color code to push the color decision until later (probably first use). The latter is the right way, I think, but it's going to take some surgery.

Either way, let's scrap my patch. The bug it introduces is just as bad as the bug it fixes.

Thanks for noticing.
-Peff
Previous: Junio C Hamano
Message 4 of 4 in “fix color.pager = false with "git diff"”
  1. fix color.pager = false with "git diff"Jeff King, Oct 21, 2010
  2. Jonathan NiederOct 21, 2010
  3. Junio C HamanoOct 21, 2010
  4. Jeff KingOct 22, 2010

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.