summaryrefslogtreecommitdiff
path: root/builtin/add.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2019-12-05 12:52:43 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-12-05 12:52:43 -0800
commitf7998d979322c439578a4334524ae2c924042705 (patch)
treedee4df2a225eebc8e83bb5b54fa93835cdf3b498 /builtin/add.c
parentMerge branch 'js/rebase-r-safer-label' (diff)
parentbuilt-in add -i: implement the `help` command (diff)
downloadtgif-f7998d979322c439578a4334524ae2c924042705.tar.xz
Merge branch 'js/builtin-add-i'
The beginning of rewriting "git add -i" in C. * js/builtin-add-i: built-in add -i: implement the `help` command built-in add -i: use color in the main loop built-in add -i: support `?` (prompt help) built-in add -i: show unique prefixes of the commands built-in add -i: implement the main loop built-in add -i: color the header in the `status` command built-in add -i: implement the `status` command diff: export diffstat interface Start to implement a built-in version of `git add --interactive`
Diffstat (limited to 'builtin/add.c')
-rw-r--r--builtin/add.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/builtin/add.c b/builtin/add.c
index dd18e5c9b6..d4686d5218 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -20,6 +20,7 @@
#include "bulk-checkin.h"
#include "argv-array.h"
#include "submodule.h"
+#include "add-interactive.h"
static const char * const builtin_add_usage[] = {
N_("git add [<options>] [--] <pathspec>..."),
@@ -185,6 +186,16 @@ int run_add_interactive(const char *revision, const char *patch_mode,
{
int status, i;
struct argv_array argv = ARGV_ARRAY_INIT;
+ int use_builtin_add_i =
+ git_env_bool("GIT_TEST_ADD_I_USE_BUILTIN", -1);
+
+ if (!patch_mode) {
+ if (use_builtin_add_i < 0)
+ git_config_get_bool("add.interactive.usebuiltin",
+ &use_builtin_add_i);
+ if (use_builtin_add_i == 1)
+ return !!run_add_i(the_repository, pathspec);
+ }
argv_array_push(&argv, "add--interactive");
if (patch_mode)
@@ -319,6 +330,7 @@ static int add_config(const char *var, const char *value, void *cb)
ignore_add_errors = git_config_bool(var, value);
return 0;
}
+
return git_default_config(var, value, cb);
}