summaryrefslogtreecommitdiff
path: root/add-interactive.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2020-01-14 18:43:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-01-15 20:06:16 (GMT)
commit180f48df69d8e7a1a413d7c11907ecf975f09cf7 (patch)
treefc919d689fdeaac5aaac15fa0a8470c6e5e6eaa4 /add-interactive.c
parent1e4ffc765db69c1c2061452c122caf17c7fb25f3 (diff)
downloadgit-180f48df69d8e7a1a413d7c11907ecf975f09cf7.zip
git-180f48df69d8e7a1a413d7c11907ecf975f09cf7.tar.gz
git-180f48df69d8e7a1a413d7c11907ecf975f09cf7.tar.bz2
built-in add -p: support interactive.diffFilter
The Perl version supports post-processing the colored diff (that is generated in addition to the uncolored diff, intended to offer a prettier user experience) by a command configured via that config setting, and now the built-in version does that, too. 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.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/add-interactive.c b/add-interactive.c
index a5bb14f..1786ea2 100644
--- a/add-interactive.c
+++ b/add-interactive.c
@@ -52,6 +52,17 @@ void init_add_i_state(struct add_i_state *s, struct repository *r)
diff_get_color(s->use_color, DIFF_FILE_OLD));
init_color(r, s, "new", s->file_new_color,
diff_get_color(s->use_color, DIFF_FILE_NEW));
+
+ FREE_AND_NULL(s->interactive_diff_filter);
+ git_config_get_string("interactive.difffilter",
+ &s->interactive_diff_filter);
+}
+
+void clear_add_i_state(struct add_i_state *s)
+{
+ FREE_AND_NULL(s->interactive_diff_filter);
+ memset(s, 0, sizeof(*s));
+ s->use_color = -1;
}
/*
@@ -1149,6 +1160,7 @@ int run_add_i(struct repository *r, const struct pathspec *ps)
strbuf_release(&print_file_item_data.worktree);
strbuf_release(&header);
prefix_item_list_clear(&commands);
+ clear_add_i_state(&s);
return res;
}