public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jeff King <peff@peff•net>
To: Isaac Oscar Gariano <isaacoscar@live•com.au>
Cc: git@vger•kernel.org
Subject: [PATCH 0/4] oddities around add-interactive and color
Date: Thu, 21 Aug 2025 03:07:40 -0400	[thread overview]
Message-ID: <20250821070740.GA3356411@coredump.intra.peff.net> (raw)
In-Reply-To: <20250820220439.GA1668511@coredump.intra.peff.net>

On Wed, Aug 20, 2025 at 06:04:40PM -0400, Jeff King wrote:

> 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

  parent reply	other threads:[~2025-08-21  7:07 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-20 11:05 [BUG] Some subcommands ignore color.diff and color.ui in --patch mode Isaac Oscar Gariano
2025-08-20 22:04 ` Jeff King
2025-08-20 23:48   ` Isaac Oscar Gariano
2025-08-21  7:00     ` Jeff King
2025-08-21  7:07   ` Jeff King [this message]
2025-08-21  7:15     ` [PATCH 1/4] stash: pass --no-color to diff-tree child processes Jeff King
2025-09-03  7:23       ` Patrick Steinhardt
2025-09-08 16:06         ` Jeff King
2025-08-21  7:19     ` [PATCH 2/4] add-interactive: respect color.diff for diff coloring Jeff King
2025-09-03  7:23       ` Patrick Steinhardt
2025-09-08 16:16         ` Jeff King
2025-09-09  6:06           ` Patrick Steinhardt
2025-08-21  7:22     ` [PATCH 3/4] add-interactive: manually fall back color config to color.ui Jeff King
2025-08-21 15:42       ` Junio C Hamano
2025-09-03  7:23       ` Patrick Steinhardt
2025-09-08 16:17         ` Jeff King
2025-08-21  7:22     ` [PATCH 4/4] contrib/diff-highlight: mention interactive.diffFilter Jeff King
2025-09-08 16:41     ` [PATCH v2 0/4] oddities around add-interactive and color Jeff King
2025-09-08 16:42       ` [PATCH v2 1/4] stash: pass --no-color to diff plumbing child processes Jeff King
2025-09-08 16:42       ` [PATCH v2 2/4] add-interactive: respect color.diff for diff coloring Jeff King
2025-09-08 16:42       ` [PATCH v2 3/4] add-interactive: manually fall back color config to color.ui Jeff King
2025-09-08 16:42       ` [PATCH v2 4/4] contrib/diff-highlight: mention interactive.diffFilter Jeff King
2025-09-09  6:09       ` [PATCH v2 0/4] oddities around add-interactive and color Patrick Steinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250821070740.GA3356411@coredump.intra.peff.net \
    --to=peff@peff$(echo .)net \
    --cc=git@vger$(echo .)kernel.org \
    --cc=isaacoscar@live$(echo .)com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox