Skip to content

Commit 8302074

Browse files
committed
Merge branch 'other-command-p-in-c'
At this stage on the journey to a fully built-in `git add`, we already have everything we need, including the `--interactive` and `--patch` options, as long as the `add.interactive.useBuiltin` setting is set to `true` (kind of a "turned off feature flag", which it will be for a while, until we get confident enough that the built-in version does the job, and retire the Perl script). However, the internal `add--interactive` helper is also used to back the `--patch` option of `git stash`, `git reset` and `git checkout`. This patch series brings them "online". Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 93910cc + 48ce73c commit 8302074

File tree

7 files changed

+318
-43
lines changed

7 files changed

+318
-43
lines changed

add-interactive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,
839839
parse_pathspec(&ps_selected,
840840
PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
841841
PATHSPEC_LITERAL_PATH, "", args.argv);
842-
res = run_add_p(s->r, &ps_selected);
842+
res = run_add_p(s->r, ADD_P_STAGE, NULL, &ps_selected);
843843
argv_array_clear(&args);
844844
clear_pathspec(&ps_selected);
845845
}

add-interactive.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ const char *get_add_i_color(enum color_add_i ix);
3131
struct repository;
3232
struct pathspec;
3333
int run_add_i(struct repository *r, const struct pathspec *ps);
34-
int run_add_p(struct repository *r, const struct pathspec *ps);
34+
35+
enum add_p_mode {
36+
ADD_P_STAGE,
37+
ADD_P_STASH,
38+
ADD_P_RESET,
39+
ADD_P_CHECKOUT,
40+
};
41+
42+
int run_add_p(struct repository *r, enum add_p_mode mode,
43+
const char *revision, const struct pathspec *ps);
3544

3645
#endif

0 commit comments

Comments
 (0)