Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-02-06 01:34:58 +0300
committerJunio C Hamano <gitster@pobox.com>2020-02-06 01:34:58 +0300
commit76c57fedfa8a15bd341c0059bff164a049fe1d5c (patch)
tree5b4a2fd0b9b73b2614ea1b0ef1b048a3b7df4d7c /add-interactive.c
parent9a5315edfdf662c4d9bf444ebc297bc802fa5e04 (diff)
parentb2627cc3d4be2f8086711097f99d79a32c6a703a (diff)
Merge branch 'js/add-p-leftover-bits'
The final leg of rewriting "add -i/-p" in C. * js/add-p-leftover-bits: ci: include the built-in `git add -i` in the `linux-gcc` job built-in add -p: handle Escape sequences more efficiently built-in add -p: handle Escape sequences in interactive.singlekey mode built-in add -p: respect the `interactive.singlekey` config setting terminal: add a new function to read a single keystroke terminal: accommodate Git for Windows' default terminal terminal: make the code of disable_echo() reusable built-in add -p: handle diff.algorithm built-in add -p: support interactive.diffFilter t3701: adjust difffilter test
Diffstat (limited to 'add-interactive.c')
-rw-r--r--add-interactive.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/add-interactive.c b/add-interactive.c
index 577cef3842..4a9bf85cac 100644
--- a/add-interactive.c
+++ b/add-interactive.c
@@ -52,6 +52,24 @@ 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);
+
+ FREE_AND_NULL(s->interactive_diff_algorithm);
+ git_config_get_string("diff.algorithm",
+ &s->interactive_diff_algorithm);
+
+ git_config_get_bool("interactive.singlekey", &s->use_single_key);
+}
+
+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;
}
/*
@@ -1152,6 +1170,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;
}