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

Re: [PATCH 1/2] handle color.ui at a central place

From
Markus Heidelberg <markus.heidelberg@web.de>
Date
Jan 24, 2009, 11:28 UTC
Message-ID
<200901241228.33690.markus.heidelberg@web.de>
In-Reply-To
<7vmydi4kiz.fsf@gitster.siamese.dyndns.org>
Junio C Hamano, 23.01.2009:
Show 21 quoted lines
> Markus Heidelberg <markus.heidelberg@web.de> writes:
> 
> > Jeff King, 22.01.2009:
> > ...
> >> > ...
> >> > That would probably be better.
> >> 
> >> Do you want to work on it, or should it go into the "yeah, right, one
> >> day" section of my todo list?
> >
> > Yes, feel free to enlarge your todo list :)
> > There are some other things that I want to work on before, so better
> > don't count on me for this. But maybe I'll come up to it, before your
> > todo list pointer reaches this item, who knows.
> 
> Whatever.
> 
> I merged and pushed out these two patches but they seem to break
> format-patch big time if you have ui.color set to auto.
> 
> I will be reverting them out of 'next'.  Grumble.
Damn, sorry for this.
I looked at the code and found this in git_format_config():
	if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff")) {
		return 0;

Which of course didn't handle color.ui, but that wasn't necessary before the central color.ui handling from my patch.

So with the following diff it works:

- if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff")) { + if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff") + || !strcmp(var, "color.ui")) {

Compared to f3aafa4 (Disable color detection during format-patch, 2006-07-09) and a159ca0 (Allow subcommand.color and color.subcommand color configuration, 2006-12-13), which introduced !strcmp(var, "diff.color") resp. !strcmp(var, "color.diff") at this place.

Or with this, which however would be a similar thing to what I tried to remove from the code.

        git_config(git_format_config, NULL);
+       diff_use_color_default = 0;

format-patch is perhaps the only place where the commit has broken things, because I didn't find other places, where color config options were set, but not the corresponding variables. So it seems as if only format-patch needed code like this to turn off the colors.

Markus
Previous: Junio C HamanoNext: Johannes Schindelin
Message 23 of 40 in “Re: [PATCH 3/3] Adds a #!bash to the top of bash completions so that editors can recognize, it as a bash script. Also adds a few simple comments above commands that, take arguments. The comments are meant to remind editors of potential, problems that”
  1. BazJan 16, 2009
  2. Jeff KingJan 17, 2009
  3. Markus HeidelbergJan 17, 2009
  4. Jeff KingJan 17, 2009
  5. 1/2 color: make it easier for non-config to parse color specsJeff King, Jan 17, 2009
  6. René ScharfeJan 18, 2009
  7. Jeff KingJan 18, 2009
  8. Jeff KingJan 18, 2009
  9. René ScharfeJan 18, 2009
  10. Jeff KingJan 18, 2009
  11. 2/2 expand --pretty=format color optionsJeff King, Jan 17, 2009
  12. René ScharfeJan 18, 2009
  13. Jeff KingJan 18, 2009
  14. Jeff KingJan 18, 2009
  15. Jeff KingJan 18, 2009
  16. 1/2 handle color.ui at a central placeMarkus Heidelberg, Jan 18, 2009
  17. 2/2 move the color variables to color.cMarkus Heidelberg, Jan 18, 2009
  18. Jeff KingJan 20, 2009
  19. Markus HeidelbergJan 21, 2009
  20. Jeff KingJan 22, 2009
  21. Markus HeidelbergJan 22, 2009
  22. Junio C HamanoJan 23, 2009
  23. Markus HeidelbergJan 24, 2009
  24. Johannes SchindelinJan 24, 2009
  25. Markus HeidelbergJan 24, 2009
  26. Junio C HamanoJan 24, 2009
  27. Jeff KingJan 24, 2009
  28. Junio C HamanoJan 24, 2009
  29. Jeff KingJan 24, 2009
  30. Markus HeidelbergJan 25, 2009
  31. Junio C HamanoJan 19, 2009
  32. Jeff KingJan 20, 2009
  33. Johannes SchindelinJan 20, 2009
  34. Johannes SchindelinJan 20, 2009
  35. Jeff KingJan 20, 2009
  36. Johannes SchindelinJan 20, 2009
  37. Jeff KingJan 20, 2009
  38. Cyellow, was Re: [a way-too-long line]Johannes Schindelin, Jan 17, 2009
  39. Jeff KingJan 17, 2009
  40. Johannes SchindelinJan 17, 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.