Skip to content

Commit 84c8289

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 118eafc + 03bed2b commit 84c8289

File tree

8 files changed

+390
-55
lines changed

8 files changed

+390
-55
lines changed

add-interactive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,
918918
parse_pathspec(&ps_selected,
919919
PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
920920
PATHSPEC_LITERAL_PATH, "", args.argv);
921-
res = run_add_p(s->r, &ps_selected);
921+
res = run_add_p(s->r, ADD_P_STAGE, NULL, &ps_selected);
922922
argv_array_clear(&args);
923923
clear_pathspec(&ps_selected);
924924
}

add-interactive.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ 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+
ADD_P_WORKTREE,
41+
};
42+
43+
int run_add_p(struct repository *r, enum add_p_mode mode,
44+
const char *revision, const struct pathspec *ps);
3545

3646
#endif

0 commit comments

Comments
 (0)