diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-12-25 11:22:00 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-12-25 11:22:01 -0800 |
commit | 45b96a6fa1ce2009f82d2ea1698b49fda0c11169 (patch) | |
tree | af4794f1aeb7ebe2ad500bec4f66205d82cbd245 /builtin/add.c | |
parent | Merge branch 'jc/drop-gen-hdrs' (diff) | |
parent | built-in add -p: show helpful hint when nothing can be staged (diff) | |
download | tgif-45b96a6fa1ce2009f82d2ea1698b49fda0c11169.tar.xz |
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.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/builtin/add.c b/builtin/add.c index 7c21ad492b..4c38aff419 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"); |