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

Re: [PATCH] document behavior of empty color name

From
Duy Nguyen <pclouds@gmail.com>
Date
Feb 3, 2017, 09:24 UTC
Message-ID
<20170203092430.GA10987@ash>
In-Reply-To
<20170202124238.53k74cedpp2rcmzo@sigill.intra.peff.net>
On Thu, Feb 02, 2017 at 01:42:44PM +0100, Jeff King wrote:
Show 28 quoted lines
> On Thu, Feb 02, 2017 at 04:16:15PM +0700, Duy Nguyen wrote:
> 
> > > I hadn't heard anything back,
> > 
> > Sorry I was accidentally busy during Luna new year holiday.
> 
> No problem. That sounds much more fun than working on Git. :)
> 
> > > -	if (!len)
> > > -		return -1;
> > > +	if (!len) {
> > > +		dst[0] = '\0';
> > > +		return 0;
> > > +	}
> > >  
> > >  	if (!strncasecmp(ptr, "reset", len)) {
> > >  		xsnprintf(dst, end - dst, GIT_COLOR_RESET);
> > 
> > I wonder if it makes more sense to do this in builtin/config.c. The
> > "default value" business is strictly git-config command's. The parsing
> > function does not need to know. Maybe something like this?
> 
> I don't think so. The default value is a git-config thing, but you would
> want to be able to do the same thing in a config file. For example, to
> disable coloring entirely for part of the diff, you could do:
> 
>   [color "diff"]
>   meta = ""

OK but it makes log.graphColors add empty colors though. In t4202.39, we have " blue,invalid-color, cyan, red , ". With this patch the color after red would be no color. Without it, we get a complaint and the next color would be cycled back to blue. The test does not catch this because the test graph does not have enough fork points to get to red and back to blue.

I suppose this is ok after your documentation patch ("that's by design!"). Just wanted to point it out in case I miss something. -- Duy

Previous: Jeff KingNext: Jeff King
Message 6 of 11 in “What's cooking in git.git (Jan 2017, #06; Tue, 31)”
  1. Junio C HamanoJan 31, 2017
  2. color_parse_mem: allow empty color specJeff King, Feb 1, 2017
  3. Jacob KellerFeb 1, 2017
  4. Duy NguyenFeb 2, 2017
  5. document behavior of empty color nameJeff King, Feb 2, 2017
  6. Duy NguyenFeb 3, 2017
  7. Jeff KingFeb 3, 2017
  8. Junio C HamanoFeb 3, 2017
  9. Jeff KingFeb 4, 2017
  10. Patrick SteinhardtFeb 1, 2017
  11. Junio C HamanoFeb 1, 2017

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.