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:
parent
a6a323b31e
commit
20b813d7d3
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,7 +14,6 @@
|
||||
/bin-wrappers/
|
||||
/git
|
||||
/git-add
|
||||
/git-add--interactive
|
||||
/git-am
|
||||
/git-annotate
|
||||
/git-apply
|
||||
|
@ -7,6 +7,7 @@ add.ignore-errors (deprecated)::
|
||||
variables.
|
||||
|
||||
add.interactive.useBuiltin::
|
||||
Set to `false` to fall back to the original Perl implementation of
|
||||
the interactive version of linkgit:git-add[1] instead of the built-in
|
||||
version. Is `true` by default.
|
||||
Unused configuration variable. Used in Git versions v2.25.0 to
|
||||
v2.36.0 to enable the built-in version of linkgit:git-add[1]'s
|
||||
interactive mode, which then became the default in Git
|
||||
versions v2.37.0 to v2.39.0.
|
||||
|
2
INSTALL
2
INSTALL
@ -120,7 +120,7 @@ Issues of note:
|
||||
for everyday use (e.g. "bisect", "request-pull").
|
||||
|
||||
- "Perl" version 5.8 or later is needed to use some of the
|
||||
features (e.g. preparing a partial commit using "git add -i/-p",
|
||||
features (e.g. sending patches using "git send-email",
|
||||
interacting with svn repositories with "git svn"). If you can
|
||||
live without these, use NO_PERL. Note that recent releases of
|
||||
Redhat/Fedora are reported to ship Perl binary package with some
|
||||
|
1
Makefile
1
Makefile
@ -708,7 +708,6 @@ SCRIPT_LIB += git-mergetool--lib
|
||||
SCRIPT_LIB += git-sh-i18n
|
||||
SCRIPT_LIB += git-sh-setup
|
||||
|
||||
SCRIPT_PERL += git-add--interactive.perl
|
||||
SCRIPT_PERL += git-archimport.perl
|
||||
SCRIPT_PERL += git-cvsexportcommit.perl
|
||||
SCRIPT_PERL += git-cvsimport.perl
|
||||
|
@ -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 |
|
||||
|
@ -26,7 +26,6 @@ linux-TEST-vars)
|
||||
export GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1
|
||||
export GIT_TEST_MULTI_PACK_INDEX=1
|
||||
export GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=1
|
||||
export GIT_TEST_ADD_I_USE_BUILTIN=0
|
||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
|
||||
export GIT_TEST_WRITE_REV_INDEX=1
|
||||
export GIT_TEST_CHECKOUT_WORKERS=2
|
||||
|
File diff suppressed because it is too large
Load Diff
4
t/README
4
t/README
@ -449,10 +449,6 @@ the --sparse command-line argument.
|
||||
GIT_TEST_PRELOAD_INDEX=<boolean> exercises the preload-index code path
|
||||
by overriding the minimum number of cache entries required per thread.
|
||||
|
||||
GIT_TEST_ADD_I_USE_BUILTIN=<boolean>, when false, disables the
|
||||
built-in version of git add -i. See 'add.interactive.useBuiltin' in
|
||||
git-config(1).
|
||||
|
||||
GIT_TEST_INDEX_THREADS=<n> enables exercising the multi-threaded loading
|
||||
of the index for the whole test suite by bypassing the default number of
|
||||
cache entries and thread minimums. Setting this to 1 will make the
|
||||
|
@ -4,12 +4,6 @@ test_description='git checkout --patch'
|
||||
|
||||
. ./lib-patch-mode.sh
|
||||
|
||||
if ! test_have_prereq ADD_I_USE_BUILTIN && ! test_have_prereq PERL
|
||||
then
|
||||
skip_all='skipping interactive add tests, PERL not set'
|
||||
test_done
|
||||
fi
|
||||
|
||||
test_expect_success 'setup' '
|
||||
mkdir dir &&
|
||||
echo parent > dir/foo &&
|
||||
|
@ -7,7 +7,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||
. ./test-lib.sh
|
||||
. "$TEST_DIRECTORY"/lib-terminal.sh
|
||||
|
||||
if test_have_prereq !ADD_I_USE_BUILTIN,!PERL
|
||||
if test_have_prereq !PERL
|
||||
then
|
||||
skip_all='skipping add -i (scripted) tests, perl not available'
|
||||
test_done
|
||||
@ -46,6 +46,21 @@ force_color () {
|
||||
)
|
||||
}
|
||||
|
||||
test_expect_success 'warn about add.interactive.useBuiltin' '
|
||||
cat >expect <<-\EOF &&
|
||||
warning: the add.interactive.useBuiltin setting has been removed!
|
||||
See its entry in '\''git help config'\'' for details.
|
||||
No changes.
|
||||
EOF
|
||||
|
||||
for v in = =true =false
|
||||
do
|
||||
git -c "add.interactive.useBuiltin$v" add -p >out 2>actual &&
|
||||
test_must_be_empty out &&
|
||||
test_cmp expect actual || return 1
|
||||
done
|
||||
'
|
||||
|
||||
test_expect_success 'setup (initial)' '
|
||||
echo content >file &&
|
||||
git add file &&
|
||||
@ -547,15 +562,7 @@ test_expect_success 'split hunk "add -p (edit)"' '
|
||||
! grep "^+15" actual
|
||||
'
|
||||
|
||||
test_expect_success 'setup ADD_I_USE_BUILTIN check' '
|
||||
result=success &&
|
||||
if ! test_have_prereq ADD_I_USE_BUILTIN
|
||||
then
|
||||
result=failure
|
||||
fi
|
||||
'
|
||||
|
||||
test_expect_$result 'split hunk "add -p (no, yes, edit)"' '
|
||||
test_expect_success 'split hunk "add -p (no, yes, edit)"' '
|
||||
test_write_lines 5 10 20 21 30 31 40 50 60 >test &&
|
||||
git reset &&
|
||||
# test sequence is s(plit), n(o), y(es), e(dit)
|
||||
@ -579,7 +586,7 @@ test_expect_success 'split hunk with incomplete line at end' '
|
||||
test_must_fail git grep --cached before
|
||||
'
|
||||
|
||||
test_expect_$result 'edit, adding lines to the first hunk' '
|
||||
test_expect_success 'edit, adding lines to the first hunk' '
|
||||
test_write_lines 10 11 20 30 40 50 51 60 >test &&
|
||||
git reset &&
|
||||
tr _ " " >patch <<-EOF &&
|
||||
|
@ -293,11 +293,7 @@ test_expect_success 'add with all negative' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_lazy_prereq ADD_I_USE_BUILTIN_OR_PERL '
|
||||
test_have_prereq ADD_I_USE_BUILTIN || test_have_prereq PERL
|
||||
'
|
||||
|
||||
test_expect_success ADD_I_USE_BUILTIN_OR_PERL 'add -p with all negative' '
|
||||
test_expect_success 'add -p with all negative' '
|
||||
H=$(git rev-parse HEAD) &&
|
||||
git reset --hard $H &&
|
||||
git clean -f &&
|
||||
|
@ -1937,10 +1937,6 @@ test_lazy_prereq SHA1 '
|
||||
esac
|
||||
'
|
||||
|
||||
test_lazy_prereq ADD_I_USE_BUILTIN '
|
||||
test_bool_env GIT_TEST_ADD_I_USE_BUILTIN true
|
||||
'
|
||||
|
||||
# Ensure that no test accidentally triggers a Git command
|
||||
# that runs the actual maintenance scheduler, affecting a user's
|
||||
# system permanently.
|
||||
|
Loading…
Reference in New Issue
Block a user