diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2023-02-07 01:58:56 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-02-07 02:03:34 +0300 |
commit | 20b813d7d3dc576aa58de22da2450b49116945bf (patch) | |
tree | 65b0eefe69a58901e3aeade72141263321a8aac1 /builtin | |
parent | a6a323b31e2bcbac2518bddec71ea7ad558870eb (diff) |
add: remove "add.interactive.useBuiltin" & Perl "git add--interactive"
Since [1] first released with Git v2.37.0 the built-in version of "add
-i" has been the default. That built-in implementation was added in
[2], first released with Git v2.25.0.
At this point enough time has passed to allow for finding any
remaining bugs in this new implementation, so let's remove the
fallback code.
As with similar migrations for "stash"[3] and "rebase"[4] we're
keeping a mention of "add.interactive.useBuiltin" in the
documentation, but adding a warning() to notify any outstanding users
that the built-in is now the default. As with [5] and [6] we should
follow-up in the future and eventually remove that warning.
1. 0527ccb1b55 (add -i: default to the built-in implementation,
2021-11-30)
2. f83dff60a78 (Start to implement a built-in version of `git add
--interactive`, 2019-11-13)
3. 8a2cd3f5123 (stash: remove the stash.useBuiltin setting,
2020-03-03)
4. d03ebd411c6 (rebase: remove the rebase.useBuiltin setting,
2019-03-18)
5. deeaf5ee077 (stash: remove documentation for `stash.useBuiltin`,
2022-01-27)
6. 9bcde4d5314 (rebase: remove transitory rebase.useBuiltin setting &
env, 2021-03-23)
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/add.c | 66 |
1 files changed, 23 insertions, 43 deletions
diff --git a/builtin/add.c b/builtin/add.c index 0c60402267..9f5b6e26a0 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -241,55 +241,35 @@ static int refresh(int verbose, const struct pathspec *pathspec) int run_add_interactive(const char *revision, const char *patch_mode, const struct pathspec *pathspec) { - int i; - struct child_process cmd = CHILD_PROCESS_INIT; - int use_builtin_add_i = - git_env_bool("GIT_TEST_ADD_I_USE_BUILTIN", -1); - - if (use_builtin_add_i < 0 && - git_config_get_bool("add.interactive.usebuiltin", - &use_builtin_add_i)) - use_builtin_add_i = 1; - - if (use_builtin_add_i != 0) { - enum add_p_mode mode; - - if (!patch_mode) - return !!run_add_i(the_repository, pathspec); - - if (!strcmp(patch_mode, "--patch")) - mode = ADD_P_ADD; - else if (!strcmp(patch_mode, "--patch=stash")) - mode = ADD_P_STASH; - else if (!strcmp(patch_mode, "--patch=reset")) - mode = ADD_P_RESET; - else if (!strcmp(patch_mode, "--patch=checkout")) - mode = ADD_P_CHECKOUT; - else if (!strcmp(patch_mode, "--patch=worktree")) - mode = ADD_P_WORKTREE; - else - die("'%s' not supported", patch_mode); - - return !!run_add_p(the_repository, mode, revision, pathspec); - } + enum add_p_mode mode; + + if (!patch_mode) + return !!run_add_i(the_repository, pathspec); + + if (!strcmp(patch_mode, "--patch")) + mode = ADD_P_ADD; + else if (!strcmp(patch_mode, "--patch=stash")) + mode = ADD_P_STASH; + else if (!strcmp(patch_mode, "--patch=reset")) + mode = ADD_P_RESET; + else if (!strcmp(patch_mode, "--patch=checkout")) + mode = ADD_P_CHECKOUT; + else if (!strcmp(patch_mode, "--patch=worktree")) + mode = ADD_P_WORKTREE; + else + die("'%s' not supported", patch_mode); - strvec_push(&cmd.args, "add--interactive"); - if (patch_mode) - strvec_push(&cmd.args, patch_mode); - if (revision) - strvec_push(&cmd.args, revision); - strvec_push(&cmd.args, "--"); - for (i = 0; i < pathspec->nr; i++) - /* pass original pathspec, to be re-parsed */ - strvec_push(&cmd.args, pathspec->items[i].original); - - cmd.git_cmd = 1; - return run_command(&cmd); + return !!run_add_p(the_repository, mode, revision, pathspec); } int interactive_add(const char **argv, const char *prefix, int patch) { struct pathspec pathspec; + int unused; + + if (!git_config_get_bool("add.interactive.usebuiltin", &unused)) + warning(_("the add.interactive.useBuiltin setting has been removed!\n" + "See its entry in 'git help config' for details.")); parse_pathspec(&pathspec, 0, PATHSPEC_PREFER_FULL | |