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.0527ccb1b5(add -i: default to the built-in implementation, 2021-11-30) 2.f83dff60a7(Start to implement a built-in version of `git add --interactive`, 2019-11-13) 3.8a2cd3f512(stash: remove the stash.useBuiltin setting, 2020-03-03) 4.d03ebd411c(rebase: remove the rebase.useBuiltin setting, 2019-03-18) 5.deeaf5ee07(stash: remove documentation for `stash.useBuiltin`, 2022-01-27) 6.9bcde4d531(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>
This commit is contained in:
committed by
Junio C Hamano
parent
a6a323b31e
commit
20b813d7d3
@@ -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);
|
||||
enum add_p_mode mode;
|
||||
|
||||
if (use_builtin_add_i < 0 &&
|
||||
git_config_get_bool("add.interactive.usebuiltin",
|
||||
&use_builtin_add_i))
|
||||
use_builtin_add_i = 1;
|
||||
if (!patch_mode)
|
||||
return !!run_add_i(the_repository, pathspec);
|
||||
|
||||
if (use_builtin_add_i != 0) {
|
||||
enum add_p_mode mode;
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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 |
|
||||
|
||||
Reference in New Issue
Block a user