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

[PATCH 0/4] oddities around add-interactive and color

From
Jeff King <peff@peff.net>
Date
Aug 21, 2025, 07:07 UTC
Message-ID
<20250821070740.GA3356411@coredump.intra.peff.net>
In-Reply-To
<20250820220439.GA1668511@coredump.intra.peff.net>
On Wed, Aug 20, 2025 at 06:04:40PM -0400, Jeff King wrote:
Show 19 quoted lines
> I'd expect something like this:
> 
> diff --git a/add-interactive.c b/add-interactive.c
> index 3e692b47ec..ad8b4907e1 100644
> --- a/add-interactive.c
> +++ b/add-interactive.c
> @@ -50,6 +50,8 @@ void init_add_i_state(struct add_i_state *s, struct repository *r,
>  	else
>  		s->use_color =
>  			git_config_colorbool("color.interactive", value);
> +	if (s->use_color < 0 && !repo_config_get_value(r, "color.ui", &value))
> +		s->use_color = git_config_colorbool("color.ui", value);
>  	s->use_color = want_color(s->use_color);
>  
>  	init_color(r, s, "interactive.header", s->header_color, GIT_COLOR_BOLD);
> 
> to work, but it doesn't seem to. Maybe the diff code is independently
> looking at git_use_color_default, and we really do need to set the
> variable?

Ah, indeed. There's yet another bug here. And while adding a test for that, I found a third bug. Yikes.

So here's a series which I think addresses everything I found. These bugs have been lurking for a while, but I guess not many people tend to set color variables to anything exotic.

  [1/4]: stash: pass --no-color to diff-tree child processes
  [2/4]: add-interactive: respect color.diff for diff coloring
  [3/4]: add-interactive: manually fall back color config to color.ui
  [4/4]: contrib/diff-highlight: mention interactive.diffFilter
 add-interactive.c             | 88 ++++++++++++++++++++++-------------
 add-interactive.h             |  7 ++-
 add-patch.c                   | 12 ++---
 builtin/stash.c               |  4 +-
 contrib/diff-highlight/README |  8 ++++
 t/t3701-add-interactive.sh    | 51 ++++++++++++++++++++
 t/t3904-stash-patch.sh        | 10 ++++
 7 files changed, 138 insertions(+), 42 deletions(-)
-Peff
Previous: Jeff KingNext: Jeff King
Message 5 of 23 in “[BUG] Some subcommands ignore color.diff and color.ui in --patch mode”
  1. Isaac Oscar GarianoAug 20, 2025
  2. Jeff KingAug 20, 2025
  3. Isaac Oscar GarianoAug 20, 2025
  4. Jeff KingAug 21, 2025
  5. 0/4 oddities around add-interactive and colorJeff King, Aug 21, 2025
  6. 1/4 stash: pass --no-color to diff-tree child processesJeff King, Aug 21, 2025
  7. Patrick SteinhardtSep 3, 2025
  8. Jeff KingSep 8, 2025
  9. 2/4 add-interactive: respect color.diff for diff coloringJeff King, Aug 21, 2025
  10. Patrick SteinhardtSep 3, 2025
  11. Jeff KingSep 8, 2025
  12. Patrick SteinhardtSep 9, 2025
  13. 3/4 add-interactive: manually fall back color config to color.uiJeff King, Aug 21, 2025
  14. Junio C HamanoAug 21, 2025
  15. Patrick SteinhardtSep 3, 2025
  16. Jeff KingSep 8, 2025
  17. 4/4 contrib/diff-highlight: mention interactive.diffFilterJeff King, Aug 21, 2025
  18. 0/4 oddities around add-interactive and colorJeff King, Sep 8, 2025
  19. 1/4 stash: pass --no-color to diff plumbing child processesJeff King, Sep 8, 2025
  20. 2/4 add-interactive: respect color.diff for diff coloringJeff King, Sep 8, 2025
  21. 3/4 add-interactive: manually fall back color config to color.uiJeff King, Sep 8, 2025
  22. 4/4 contrib/diff-highlight: mention interactive.diffFilterJeff King, Sep 8, 2025
  23. Patrick SteinhardtSep 9, 2025

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.