summaryrefslogtreecommitdiff
path: root/add-interactive.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2020-11-11 12:28:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-11-11 17:07:53 (GMT)
commitc62cd1720f5c9cf57955a78576ba7e862b7352e6 (patch)
tree6af8f1bed82edbaa480ef6acc168f659818c74a5 /add-interactive.c
parent6f1a5caa0b69278bc7eb79d3474a1e881bd0c663 (diff)
downloadgit-c62cd1720f5c9cf57955a78576ba7e862b7352e6.zip
git-c62cd1720f5c9cf57955a78576ba7e862b7352e6.tar.gz
git-c62cd1720f5c9cf57955a78576ba7e862b7352e6.tar.bz2
add -i (built-in): prevent the `reset` "color" from being configured
The Perl version of that command sneakily uses `git config --get-color` to figure out the ANSI sequence to reset the color, but passes the empty string and therefore cannot actually match any config entry. This was missed when re-implementing the command as a built-in command. Let's fix this, preventing the `reset` sequence from being overridden via the config. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'add-interactive.c')
-rw-r--r--add-interactive.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/add-interactive.c b/add-interactive.c
index 0f24992..f3a1d74 100644
--- a/add-interactive.c
+++ b/add-interactive.c
@@ -44,7 +44,6 @@ void init_add_i_state(struct add_i_state *s, struct repository *r)
init_color(r, s, "help", s->help_color, GIT_COLOR_BOLD_RED);
init_color(r, s, "prompt", s->prompt_color, GIT_COLOR_BOLD_BLUE);
init_color(r, s, "error", s->error_color, GIT_COLOR_BOLD_RED);
- init_color(r, s, "reset", s->reset_color, GIT_COLOR_RESET);
init_color(r, s, "fraginfo", s->fraginfo_color,
diff_get_color(s->use_color, DIFF_FRAGINFO));
init_color(r, s, "context", s->context_color,
@@ -54,6 +53,9 @@ void init_add_i_state(struct add_i_state *s, struct repository *r)
init_color(r, s, "new", s->file_new_color,
diff_get_color(s->use_color, DIFF_FILE_NEW));
+ strlcpy(s->reset_color,
+ s->use_color ? GIT_COLOR_RESET : "", COLOR_MAXLEN);
+
FREE_AND_NULL(s->interactive_diff_filter);
git_config_get_string("interactive.difffilter",
&s->interactive_diff_filter);