Skip to content

Commit 0527ccb

Browse files
dschogitster
authored andcommitted
add -i: default to the built-in implementation
In 9a5315e (Merge branch 'js/patch-mode-in-others-in-c', 2020-02-05), Git acquired a built-in implementation of `git add`'s interactive mode that could be turned on via the config option `add.interactive.useBuiltin`. The first official Git version to support this knob was v2.26.0. In 2df2d81 (add -i: use the built-in version when feature.experimental is set, 2020-09-08), this built-in implementation was also enabled via `feature.experimental`. The first version with this change was v2.29.0. More than a year (and very few bug reports) later, it is time to declare the built-in implementation mature and to turn it on by default. We specifically leave the `add.interactive.useBuiltin` configuration in place, to give users an "escape hatch" in the unexpected case should they encounter a previously undetected bug in that implementation. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ed922dc commit 0527ccb

File tree

5 files changed

+11
-16
lines changed

5 files changed

+11
-16
lines changed

Documentation/config/add.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ add.ignore-errors (deprecated)::
77
variables.
88

99
add.interactive.useBuiltin::
10-
[EXPERIMENTAL] Set to `true` to use the experimental built-in
11-
implementation of the interactive version of linkgit:git-add[1]
12-
instead of the Perl script version. Is `false` by default.
10+
Set to `false` to fall back to the original Perl implementation of
11+
the interactive version of linkgit:git-add[1] instead of the built-in
12+
version. Is `true` by default.

builtin/add.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -237,17 +237,12 @@ int run_add_interactive(const char *revision, const char *patch_mode,
237237
int use_builtin_add_i =
238238
git_env_bool("GIT_TEST_ADD_I_USE_BUILTIN", -1);
239239

240-
if (use_builtin_add_i < 0) {
241-
int experimental;
242-
if (!git_config_get_bool("add.interactive.usebuiltin",
243-
&use_builtin_add_i))
244-
; /* ok */
245-
else if (!git_config_get_bool("feature.experimental", &experimental) &&
246-
experimental)
247-
use_builtin_add_i = 1;
248-
}
240+
if (use_builtin_add_i < 0 &&
241+
git_config_get_bool("add.interactive.usebuiltin",
242+
&use_builtin_add_i))
243+
use_builtin_add_i = 1;
249244

250-
if (use_builtin_add_i == 1) {
245+
if (use_builtin_add_i != 0) {
251246
enum add_p_mode mode;
252247

253248
if (!patch_mode)

ci/run-build-and-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ linux-gcc)
2929
export GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1
3030
export GIT_TEST_MULTI_PACK_INDEX=1
3131
export GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=1
32-
export GIT_TEST_ADD_I_USE_BUILTIN=1
32+
export GIT_TEST_ADD_I_USE_BUILTIN=0
3333
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
3434
export GIT_TEST_WRITE_REV_INDEX=1
3535
export GIT_TEST_CHECKOUT_WORKERS=2

t/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ the --sparse command-line argument.
419419
GIT_TEST_PRELOAD_INDEX=<boolean> exercises the preload-index code path
420420
by overriding the minimum number of cache entries required per thread.
421421

422-
GIT_TEST_ADD_I_USE_BUILTIN=<boolean>, when true, enables the
422+
GIT_TEST_ADD_I_USE_BUILTIN=<boolean>, when false, disables the
423423
built-in version of git add -i. See 'add.interactive.useBuiltin' in
424424
git-config(1).
425425

t/t2016-checkout-patch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test_description='git checkout --patch'
44

55
. ./lib-patch-mode.sh
66

7-
if ! test_bool_env GIT_TEST_ADD_I_USE_BUILTIN false && ! test_have_prereq PERL
7+
if ! test_bool_env GIT_TEST_ADD_I_USE_BUILTIN true && ! test_have_prereq PERL
88
then
99
skip_all='skipping interactive add tests, PERL not set'
1010
test_done

0 commit comments

Comments
 (0)