aboutsummaryrefslogtreecommitdiffstats
path: root/add-patch.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-10-15 10:29:30 -0700
committerJunio C Hamano <gitster@pobox.com>2025-10-15 10:29:31 -0700
commitb3c96ce08fd7fa3a167e7bc18f80fbc348903b1f (patch)
tree79c6bbdfc36a754de7550e78789d0c0fb3a5e6ea /add-patch.c
parentMerge branch 'sg/line-log-boundary-fixes' into maint-2.51 (diff)
parentcontrib/diff-highlight: mention interactive.diffFilter (diff)
downloadgit-b3c96ce08fd7fa3a167e7bc18f80fbc348903b1f.tar.gz
git-b3c96ce08fd7fa3a167e7bc18f80fbc348903b1f.zip
Merge branch 'jk/add-i-color' into maint-2.51
Some among "git add -p" and friends ignored color.diff and/or color.ui configuration variables, which is an old regression, which has been corrected. * jk/add-i-color: contrib/diff-highlight: mention interactive.diffFilter add-interactive: manually fall back color config to color.ui add-interactive: respect color.diff for diff coloring stash: pass --no-color to diff plumbing child processes
Diffstat (limited to 'add-patch.c')
-rw-r--r--add-patch.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/add-patch.c b/add-patch.c
index 302e6ba7d9..b0389c5d5b 100644
--- a/add-patch.c
+++ b/add-patch.c
@@ -300,7 +300,7 @@ static void err(struct add_p_state *s, const char *fmt, ...)
va_start(args, fmt);
fputs(s->s.error_color, stdout);
vprintf(fmt, args);
- puts(s->s.reset_color);
+ puts(s->s.reset_color_interactive);
va_end(args);
}
@@ -457,7 +457,7 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
}
strbuf_complete_line(plain);
- if (want_color_fd(1, -1)) {
+ if (want_color_fd(1, s->s.use_color_diff)) {
struct child_process colored_cp = CHILD_PROCESS_INIT;
const char *diff_filter = s->s.interactive_diff_filter;
@@ -714,7 +714,7 @@ static void render_hunk(struct add_p_state *s, struct hunk *hunk,
if (len)
strbuf_add(out, p, len);
else if (colored)
- strbuf_addf(out, "%s\n", s->s.reset_color);
+ strbuf_addf(out, "%s\n", s->s.reset_color_diff);
else
strbuf_addch(out, '\n');
}
@@ -1107,7 +1107,7 @@ static void recolor_hunk(struct add_p_state *s, struct hunk *hunk)
s->s.file_new_color :
s->s.context_color);
strbuf_add(&s->colored, plain + current, eol - current);
- strbuf_addstr(&s->colored, s->s.reset_color);
+ strbuf_addstr(&s->colored, s->s.reset_color_diff);
if (next > eol)
strbuf_add(&s->colored, plain + eol, next - eol);
current = next;
@@ -1528,8 +1528,8 @@ static int patch_update_file(struct add_p_state *s,
: 1));
printf(_(s->mode->prompt_mode[prompt_mode_type]),
s->buf.buf);
- if (*s->s.reset_color)
- fputs(s->s.reset_color, stdout);
+ if (*s->s.reset_color_interactive)
+ fputs(s->s.reset_color_interactive, stdout);
fflush(stdout);
if (read_single_character(s) == EOF)
break;