| 1 | #ifndef ADD_PATCH_H |
| 2 | #define ADD_PATCH_H |
| 3 | |
| 4 | #include "color.h" |
| 5 | |
| 6 | struct index_state; |
| 7 | struct pathspec; |
| 8 | struct repository; |
| 9 | |
| 10 | struct interactive_options { |
| 11 | int context; |
| 12 | int interhunkcontext; |
| 13 | int auto_advance; |
| 14 | }; |
| 15 | |
| 16 | #define INTERACTIVE_OPTIONS_INIT { \ |
| 17 | .context = -1, \ |
| 18 | .interhunkcontext = -1, \ |
| 19 | .auto_advance = 1, \ |
| 20 | } |
| 21 | |
| 22 | struct interactive_config { |
| 23 | enum git_colorbool use_color_interactive; |
| 24 | enum git_colorbool use_color_diff; |
| 25 | char header_color[COLOR_MAXLEN]; |
| 26 | char help_color[COLOR_MAXLEN]; |
| 27 | char prompt_color[COLOR_MAXLEN]; |
| 28 | char error_color[COLOR_MAXLEN]; |
| 29 | char reset_color_interactive[COLOR_MAXLEN]; |
| 30 | |
| 31 | char fraginfo_color[COLOR_MAXLEN]; |
| 32 | char context_color[COLOR_MAXLEN]; |
| 33 | char file_old_color[COLOR_MAXLEN]; |
| 34 | char file_new_color[COLOR_MAXLEN]; |
| 35 | char reset_color_diff[COLOR_MAXLEN]; |
| 36 | |
| 37 | int use_single_key; |
| 38 | char *interactive_diff_filter, *interactive_diff_algorithm; |
| 39 | int context, interhunkcontext; |
| 40 | int auto_advance; |
| 41 | }; |
| 42 | |
| 43 | void interactive_config_init(struct interactive_config *cfg, |
| 44 | struct repository *r, |
| 45 | struct interactive_options *opts); |
| 46 | void interactive_config_clear(struct interactive_config *cfg); |
| 47 | |
| 48 | enum add_p_mode { |
| 49 | ADD_P_ADD, |
| 50 | ADD_P_STASH, |
| 51 | ADD_P_RESET, |
| 52 | ADD_P_CHECKOUT, |
| 53 | ADD_P_WORKTREE, |
| 54 | }; |
| 55 | |
| 56 | enum add_p_flags { |
| 57 | /* Disallow "editing" hunks. */ |
| 58 | ADD_P_DISALLOW_EDIT = (1 << 0), |
| 59 | }; |
| 60 | |
| 61 | int run_add_p(struct repository *r, enum add_p_mode mode, |
| 62 | struct interactive_options *opts, const char *revision, |
| 63 | const struct pathspec *ps, |
| 64 | unsigned flags); |
| 65 | |
| 66 | int run_add_p_index(struct repository *r, |
| 67 | struct index_state *index, |
| 68 | const char *index_file, |
| 69 | struct interactive_options *opts, |
| 70 | const char *revision, |
| 71 | const struct pathspec *ps, |
| 72 | unsigned flags); |
| 73 | |
| 74 | #endif |