summaryrefslogtreecommitdiff
path: root/add-interactive.c
diff options
context:
space:
mode:
authorLibravatar Johannes Schindelin <johannes.schindelin@gmx.de>2020-01-14 18:43:46 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-01-15 12:06:16 -0800
commit08b1ea4c39b08b76fe2d1240ccbf6077ef19226a (patch)
tree5b5594a85ade0187b7d8cf7a115f86a129ae9506 /add-interactive.c
parentbuilt-in add -p: support interactive.diffFilter (diff)
downloadtgif-08b1ea4c39b08b76fe2d1240ccbf6077ef19226a.tar.xz
built-in add -p: handle diff.algorithm
The Perl version of `git add -p` reads the config setting `diff.algorithm` and if set, uses it to generate the diff using the specified algorithm. This patch ports that functionality to the C version. Note: just like `git-add--interactive.perl`, we do _not_ respect this config setting in `git add -i`'s `diff` command, but _only_ in the `patch` command. 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.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/add-interactive.c b/add-interactive.c
index 1786ea29c4..9e4bcb382c 100644
--- a/add-interactive.c
+++ b/add-interactive.c
@@ -56,11 +56,16 @@ void init_add_i_state(struct add_i_state *s, struct repository *r)
FREE_AND_NULL(s->interactive_diff_filter);
git_config_get_string("interactive.difffilter",
&s->interactive_diff_filter);
+
+ FREE_AND_NULL(s->interactive_diff_algorithm);
+ git_config_get_string("diff.algorithm",
+ &s->interactive_diff_algorithm);
}
void clear_add_i_state(struct add_i_state *s)
{
FREE_AND_NULL(s->interactive_diff_filter);
+ FREE_AND_NULL(s->interactive_diff_algorithm);
memset(s, 0, sizeof(*s));
s->use_color = -1;
}