diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2019-12-22 00:57:10 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-12-22 03:06:21 +0300 |
commit | d2a233cb8b9e0f7210df68c35e751e00419a8488 (patch) | |
tree | d5f2d4af1b34433534b5016d7746a9fb4ad595d9 /add-interactive.h | |
parent | 2e4083198d1508206488af4c82093ceb6cf20f4e (diff) |
built-in add -p: prepare for patch modes other than "stage"
The Perl script backing `git add -p` is used not only for that command,
but also for `git stash -p`, `git reset -p` and `git checkout -p`.
In preparation for teaching the C version of `git add -p` to support
also the latter commands, let's abstract away what is "stage" specific
into a dedicated data structure describing the differences between the
patch modes.
Finally, please note that the Perl version tries to make sure that the
diffs are only generated for the modified files. This is not actually
necessary, as the calls to Git's diff machinery already perform that
work, and perform it well. This makes it unnecessary to port the
`FILTER` field of the `%patch_modes` struct, as well as the
`get_diff_reference()` function.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'add-interactive.h')
-rw-r--r-- | add-interactive.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/add-interactive.h b/add-interactive.h index 062dc3646c..e29a769aba 100644 --- a/add-interactive.h +++ b/add-interactive.h @@ -22,6 +22,12 @@ void init_add_i_state(struct add_i_state *s, struct repository *r); struct repository; struct pathspec; int run_add_i(struct repository *r, const struct pathspec *ps); -int run_add_p(struct repository *r, const struct pathspec *ps); + +enum add_p_mode { + ADD_P_ADD, +}; + +int run_add_p(struct repository *r, enum add_p_mode mode, + const char *revision, const struct pathspec *ps); #endif |