Skip to content

Commit 4b20fcf

Browse files
committed
squash! Start to implement a built-in version of git add --interactive
[TODO! Cherry-pick the latest changes from gitgitgadget#170] Start to implement a built-in version of `git add --interactive` Unlike previous conversions to C, where we started with a built-in helper, we start this conversion by adding an interception in the `run_add_interactive()` function when the new opt-in `add.interactive.useBuiltin` config knob is turned on (or the corresponding environment variable `GIT_TEST_ADD_I_USE_BUILTIN`), and calling the new internal API function `run_add_i()` that is implemented directly in libgit.a. At this point, the built-in version of `git add -i` only states that it cannot do anything yet. In subsequent patches/patch series, the `run_add_i()` function will gain more and more functionality, until it is feature complete. The whole arc of the conversion can be found in the PRs #170-175 at https://github.com/gitgitgadget/git. The "--helper approach" can unfortunately not be used here: on Windows we face the very specific problem that a `system()` call in Perl seems to close `stdin` in the parent process when the spawned process consumes even one character from `stdin`. Which prevents us from implementing the main loop in C and still trying to hand off to the Perl script. The very real downside of the approach we have to take here is that the test suite won't pass with `GIT_TEST_ADD_I_USE_BUILTIN=true` until the conversion is complete (the `--helper` approach would have let it pass, even at each of the incremental conversion steps). Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 02af2cc commit 4b20fcf

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

builtin/add.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,6 @@ int run_add_interactive(const char *revision, const char *patch_mode,
191191
struct argv_array argv = ARGV_ARRAY_INIT;
192192
int use_builtin_add_i =
193193
git_env_bool("GIT_TEST_ADD_I_USE_BUILTIN", -1);
194-
if (use_builtin_add_i < 0)
195-
git_config_get_bool("add.interactive.usebuiltin",
196-
&use_builtin_add_i);
197194

198195
if (use_builtin_add_i == 1) {
199196
enum add_p_mode mode;

0 commit comments

Comments
 (0)