Skip to content

Commit 05b8d16

Browse files
dschoGit for Windows Build Agent
authored andcommitted
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 9500c97 + 90db07e commit 05b8d16

File tree

8 files changed

+386
-54
lines changed

8 files changed

+386
-54
lines changed

add-interactive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,7 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,
846846
parse_pathspec(&ps_selected,
847847
PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
848848
PATHSPEC_LITERAL_PATH, "", args.argv);
849-
res = run_add_p(s->r, &ps_selected);
849+
res = run_add_p(s->r, ADD_P_STAGE, NULL, &ps_selected);
850850
argv_array_clear(&args);
851851
clear_pathspec(&ps_selected);
852852
}

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)