]> git.ipfire.org Git - thirdparty/git.git/blobdiff - add-interactive.c
t4216: avoid unnecessary subshell in test_bloom_filters_not_used
[thirdparty/git.git] / add-interactive.c
index 143e6947242115d75c2225c6771455111349cea7..4a9bf85cac033b0cf22665918fccee561678eb3d 100644 (file)
@@ -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;
 }
 
 /*
@@ -927,7 +945,7 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,
                parse_pathspec(&ps_selected,
                               PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
                               PATHSPEC_LITERAL_PATH, "", args.argv);
-               res = run_add_p(s->r, &ps_selected);
+               res = run_add_p(s->r, ADD_P_ADD, NULL, &ps_selected);
                argv_array_clear(&args);
                clear_pathspec(&ps_selected);
        }
@@ -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;
 }