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

Re: [PATCH/RFC] Pro-Git thanks, Control-flow bug report

From
Jeff King <peff@peff.net>
Date
Jul 25, 2011, 19:49 UTC
Message-ID
<20110725194947.GA14659@sigill.intra.peff.net>
In-Reply-To
<20110725193941.GA95001@sherwood.local>
On Mon, Jul 25, 2011 at 09:39:41PM +0200, Steffen Daode Nurpmeso wrote:
Show 10 quoted lines
> @ Jeff King <peff@peff.net> wrote (2011-07-25 18:25+0200):
> > Hmm. What's old is new again, I guess. I posted a patch to fix this
> > almost exactly 3 years ago:
> > 
> >   http://article.gmane.org/gmane.comp.version-control.git/90427
> 
> Unfortunately your patch from then seems no longer be sufficient
> (i.e., from my point of view, say), since this is also coloured:
> 
>   ?0%0[steffen@sherwood git.git]$ ./git -c color.ui=auto -c color.pager=false log

Yeah, it only covers the "diff" case. And that is why the special-casing is a bad solution: you have to do it everywhere that you do late pager setup. (Side note: at the time the original patch was written, log actually didn't have this problem; it was introduced much later by 1fda91b). I wouldn't be surprised if there are others.

I think my patch also has the problem that:
  git -c color.ui=auto -c color.pager=false diff --color
will not properly override the config.

So probably the only sane solution is to push the "do we want color" bit into a function, rather than keeping a static variable, and then call it at the last possible minute.

-Peff
Previous: Steffen Daode Nurpmeso
Message 4 of 4 in “Pro-Git thanks, Control-flow bug report”
  1. Pro-Git thanks, Control-flow bug reportSteffen Daode Nurpmeso, Jul 25, 2011
  2. Jeff KingJul 25, 2011
  3. Steffen Daode NurpmesoJul 25, 2011
  4. Jeff KingJul 25, 2011

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.