summaryrefslogtreecommitdiff
path: root/builtin/add.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-12-25 19:22:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-12-25 19:22:01 (GMT)
commit45b96a6fa1ce2009f82d2ea1698b49fda0c11169 (patch)
treeaf4794f1aeb7ebe2ad500bec4f66205d82cbd245 /builtin/add.c
parentccc292e8620ecea28044166ac1189ccf6edfc6c7 (diff)
parent2e4083198d1508206488af4c82093ceb6cf20f4e (diff)
downloadgit-45b96a6fa1ce2009f82d2ea1698b49fda0c11169.zip
git-45b96a6fa1ce2009f82d2ea1698b49fda0c11169.tar.gz
git-45b96a6fa1ce2009f82d2ea1698b49fda0c11169.tar.bz2
Merge branch 'js/add-p-in-c'
The effort to move "git-add--interactive" to C continues. * js/add-p-in-c: built-in add -p: show helpful hint when nothing can be staged built-in add -p: only show the applicable parts of the help text built-in add -p: implement the 'q' ("quit") command built-in add -p: implement the '/' ("search regex") command built-in add -p: implement the 'g' ("goto") command built-in add -p: implement hunk editing strbuf: add a helper function to call the editor "on an strbuf" built-in add -p: coalesce hunks after splitting them built-in add -p: implement the hunk splitting feature built-in add -p: show different prompts for mode changes and deletions built-in app -p: allow selecting a mode change as a "hunk" built-in add -p: handle deleted empty files built-in add -p: support multi-file diffs built-in add -p: offer a helpful error message when hunk navigation failed built-in add -p: color the prompt and the help text built-in add -p: adjust hunk headers as needed built-in add -p: show colored hunks by default built-in add -i: wire up the new C code for the `patch` command built-in add -i: start implementing the `patch` functionality in C
Diffstat (limited to 'builtin/add.c')
-rw-r--r--builtin/add.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/builtin/add.c b/builtin/add.c
index 7c21ad4..4c38aff 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -191,12 +191,17 @@ int run_add_interactive(const char *revision, const char *patch_mode,
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)
+ if (use_builtin_add_i < 0)
+ git_config_get_bool("add.interactive.usebuiltin",
+ &use_builtin_add_i);
+
+ if (use_builtin_add_i == 1) {
+ if (!patch_mode)
return !!run_add_i(the_repository, pathspec);
+ if (strcmp(patch_mode, "--patch"))
+ die("'%s' not yet supported in the built-in add -p",
+ patch_mode);
+ return !!run_add_p(the_repository, pathspec);
}
argv_array_push(&argv, "add--interactive");