Skip to content

Commit 20b813d

Browse files
avargitster
authored andcommitted
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. 0527ccb (add -i: default to the built-in implementation, 2021-11-30) 2. f83dff6 (Start to implement a built-in version of `git add --interactive`, 2019-11-13) 3. 8a2cd3f (stash: remove the stash.useBuiltin setting, 2020-03-03) 4. d03ebd4 (rebase: remove the rebase.useBuiltin setting, 2019-03-18) 5. deeaf5e (stash: remove documentation for `stash.useBuiltin`, 2022-01-27) 6. 9bcde4d (rebase: remove transitory rebase.useBuiltin setting & env, 2021-03-23) Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a6a323b commit 20b813d

File tree

12 files changed

+47
-2000
lines changed

12 files changed

+47
-2000
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
/bin-wrappers/
1515
/git
1616
/git-add
17-
/git-add--interactive
1817
/git-am
1918
/git-annotate
2019
/git-apply

Documentation/config/add.txt

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

99
add.interactive.useBuiltin::
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.
10+
Unused configuration variable. Used in Git versions v2.25.0 to
11+
v2.36.0 to enable the built-in version of linkgit:git-add[1]'s
12+
interactive mode, which then became the default in Git
13+
versions v2.37.0 to v2.39.0.

INSTALL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Issues of note:
120120
for everyday use (e.g. "bisect", "request-pull").
121121

122122
- "Perl" version 5.8 or later is needed to use some of the
123-
features (e.g. preparing a partial commit using "git add -i/-p",
123+
features (e.g. sending patches using "git send-email",
124124
interacting with svn repositories with "git svn"). If you can
125125
live without these, use NO_PERL. Note that recent releases of
126126
Redhat/Fedora are reported to ship Perl binary package with some

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,6 @@ SCRIPT_LIB += git-mergetool--lib
708708
SCRIPT_LIB += git-sh-i18n
709709
SCRIPT_LIB += git-sh-setup
710710

711-
SCRIPT_PERL += git-add--interactive.perl
712711
SCRIPT_PERL += git-archimport.perl
713712
SCRIPT_PERL += git-cvsexportcommit.perl
714713
SCRIPT_PERL += git-cvsimport.perl

builtin/add.c

Lines changed: 23 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -241,55 +241,35 @@ static int refresh(int verbose, const struct pathspec *pathspec)
241241
int run_add_interactive(const char *revision, const char *patch_mode,
242242
const struct pathspec *pathspec)
243243
{
244-
int i;
245-
struct child_process cmd = CHILD_PROCESS_INIT;
246-
int use_builtin_add_i =
247-
git_env_bool("GIT_TEST_ADD_I_USE_BUILTIN", -1);
248-
249-
if (use_builtin_add_i < 0 &&
250-
git_config_get_bool("add.interactive.usebuiltin",
251-
&use_builtin_add_i))
252-
use_builtin_add_i = 1;
253-
254-
if (use_builtin_add_i != 0) {
255-
enum add_p_mode mode;
256-
257-
if (!patch_mode)
258-
return !!run_add_i(the_repository, pathspec);
259-
260-
if (!strcmp(patch_mode, "--patch"))
261-
mode = ADD_P_ADD;
262-
else if (!strcmp(patch_mode, "--patch=stash"))
263-
mode = ADD_P_STASH;
264-
else if (!strcmp(patch_mode, "--patch=reset"))
265-
mode = ADD_P_RESET;
266-
else if (!strcmp(patch_mode, "--patch=checkout"))
267-
mode = ADD_P_CHECKOUT;
268-
else if (!strcmp(patch_mode, "--patch=worktree"))
269-
mode = ADD_P_WORKTREE;
270-
else
271-
die("'%s' not supported", patch_mode);
272-
273-
return !!run_add_p(the_repository, mode, revision, pathspec);
274-
}
244+
enum add_p_mode mode;
245+
246+
if (!patch_mode)
247+
return !!run_add_i(the_repository, pathspec);
248+
249+
if (!strcmp(patch_mode, "--patch"))
250+
mode = ADD_P_ADD;
251+
else if (!strcmp(patch_mode, "--patch=stash"))
252+
mode = ADD_P_STASH;
253+
else if (!strcmp(patch_mode, "--patch=reset"))
254+
mode = ADD_P_RESET;
255+
else if (!strcmp(patch_mode, "--patch=checkout"))
256+
mode = ADD_P_CHECKOUT;
257+
else if (!strcmp(patch_mode, "--patch=worktree"))
258+
mode = ADD_P_WORKTREE;
259+
else
260+
die("'%s' not supported", patch_mode);
275261

276-
strvec_push(&cmd.args, "add--interactive");
277-
if (patch_mode)
278-
strvec_push(&cmd.args, patch_mode);
279-
if (revision)
280-
strvec_push(&cmd.args, revision);
281-
strvec_push(&cmd.args, "--");
282-
for (i = 0; i < pathspec->nr; i++)
283-
/* pass original pathspec, to be re-parsed */
284-
strvec_push(&cmd.args, pathspec->items[i].original);
285-
286-
cmd.git_cmd = 1;
287-
return run_command(&cmd);
262+
return !!run_add_p(the_repository, mode, revision, pathspec);
288263
}
289264

290265
int interactive_add(const char **argv, const char *prefix, int patch)
291266
{
292267
struct pathspec pathspec;
268+
int unused;
269+
270+
if (!git_config_get_bool("add.interactive.usebuiltin", &unused))
271+
warning(_("the add.interactive.useBuiltin setting has been removed!\n"
272+
"See its entry in 'git help config' for details."));
293273

294274
parse_pathspec(&pathspec, 0,
295275
PATHSPEC_PREFER_FULL |

ci/run-build-and-tests.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ linux-TEST-vars)
2626
export GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1
2727
export GIT_TEST_MULTI_PACK_INDEX=1
2828
export GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=1
29-
export GIT_TEST_ADD_I_USE_BUILTIN=0
3029
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
3130
export GIT_TEST_WRITE_REV_INDEX=1
3231
export GIT_TEST_CHECKOUT_WORKERS=2

0 commit comments

Comments
 (0)