Skip to content

Commit

Permalink
Merge branch 'js/patch-mode-in-others-in-c' into jch
Browse files Browse the repository at this point in the history
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"
  • Loading branch information
gitster committed Jan 16, 2020
2 parents 2678299 + c480eeb commit 76bc47e
Show file tree
Hide file tree
Showing 7 changed files with 390 additions and 50 deletions.
2 changes: 1 addition & 1 deletion add-interactive.c
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ static int run_patch(struct add_i_state *s, const struct pathspec *ps,
parse_pathspec(&ps_selected,
PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
PATHSPEC_LITERAL_PATH, "", args.argv);
res = run_add_p(s->r, &ps_selected);
res = run_add_p(s->r, ADD_P_ADD, NULL, &ps_selected);
argv_array_clear(&args);
clear_pathspec(&ps_selected);
}
Expand Down
12 changes: 11 additions & 1 deletion add-interactive.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ 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,
ADD_P_STASH,
ADD_P_RESET,
ADD_P_CHECKOUT,
ADD_P_WORKTREE,
};

int run_add_p(struct repository *r, enum add_p_mode mode,
const char *revision, const struct pathspec *ps);

#endif
Loading

0 comments on commit 76bc47e

Please sign in to comment.