diff options
| author | Gatla Vishweshwar Reddy <gatlavishweshwarreddy26@gmail.com> | 2026-07-11 11:36:15 +0530 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-07-11 14:12:39 -0700 |
| commit | d0ee845a718a447cacabecf9610d2e1da6d83330 (patch) | |
| tree | fe6a4e6e8b071d63f098207ad737eaf281968d9b /t/t4013/diff.diff_initial..side | |
| parent | e9019fcafe0040228b8631c30f97ae1adb61bcdc (diff) | |
builtin/add.c: replace run_command() with direct apply_all_patches() call
When the user runs "git add -e", the diff of the working tree changes
is written to a temporary file, opened in an editor, and then applied
back to the index. The application step is done by spawning a child
process running "git apply --recount --cached <file>", which is an
unnecessary subprocess since the apply machinery is available as a
native C API.
Replace the run_command() call with a direct call to apply_all_patches()
using an initialized apply_state with the cached and recount options set
appropriately. This avoids the overhead of forking a subprocess, keeps
the operation within the same process, and makes the intent of the code
clearer to the reader.
Remove the now-unused includes of "run-command.h" and "strvec.h" since
no other code in this file requires them after this change.
Signed-off-by: Gatla Vishweshwar Reddy <gatlavishweshwarreddy26@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.diff_initial..side')
0 files changed, 0 insertions, 0 deletions
