Skip to content

Commit 01d074e

Browse files
committed
Merge branch 'js/patch-mode-in-others-in-c' into jch
The effort to move "git-add--interactive" to C continues. * js/patch-mode-in-others-in-c: commit --interactive: make it work with the built-in `add -i` built-in add -p: implement the "worktree" patch modes built-in add -p: implement the "checkout" patch modes built-in stash: use the built-in `git add -p` if so configured legacy stash -p: respect the add.interactive.usebuiltin setting built-in add -p: implement the "stash" and "reset" patch modes built-in add -p: prepare for patch modes other than "stage"
2 parents ddab31c + c480eeb commit 01d074e

File tree

7 files changed

+390
-50
lines changed

7 files changed

+390
-50
lines changed

add-interactive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,
924924
parse_pathspec(&ps_selected,
925925
PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
926926
PATHSPEC_LITERAL_PATH, "", args.argv);
927-
res = run_add_p(s->r, &ps_selected);
927+
res = run_add_p(s->r, ADD_P_ADD, NULL, &ps_selected);
928928
argv_array_clear(&args);
929929
clear_pathspec(&ps_selected);
930930
}

add-interactive.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ void init_add_i_state(struct add_i_state *s, struct repository *r);
2222
struct repository;
2323
struct pathspec;
2424
int run_add_i(struct repository *r, const struct pathspec *ps);
25-
int run_add_p(struct repository *r, const struct pathspec *ps);
25+
26+
enum add_p_mode {
27+
ADD_P_ADD,
28+
ADD_P_STASH,
29+
ADD_P_RESET,
30+
ADD_P_CHECKOUT,
31+
ADD_P_WORKTREE,
32+
};
33+
34+
int run_add_p(struct repository *r, enum add_p_mode mode,
35+
const char *revision, const struct pathspec *ps);
2636

2737
#endif

0 commit comments

Comments
 (0)