diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-02-05 23:34:58 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-02-05 23:34:58 +0100 |
commit | 76c57fedfa8a15bd341c0059bff164a049fe1d5c (patch) | |
tree | 5b4a2fd0b9b73b2614ea1b0ef1b048a3b7df4d7c /add-interactive.c | |
parent | Merge branch 'js/patch-mode-in-others-in-c' (diff) | |
parent | ci: include the built-in `git add -i` in the `linux-gcc` job (diff) | |
download | git-76c57fedfa8a15bd341c0059bff164a049fe1d5c.tar.xz git-76c57fedfa8a15bd341c0059bff164a049fe1d5c.zip |
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.c | 19 |
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; } |