| 5195 | } |
| 5196 | |
| 5197 | int apply_parse_options(int argc, const char **argv, |
| 5198 | struct apply_state *state, |
| 5199 | int *force_apply, int *options, |
| 5200 | const char * const *apply_usage) |
| 5201 | { |
| 5202 | struct option builtin_apply_options[] = { |
| 5203 | OPT_CALLBACK_F(0, "exclude", state, N_("path"), |
| 5204 | N_("don't apply changes matching the given path"), |
| 5205 | PARSE_OPT_NONEG, apply_option_parse_exclude), |
| 5206 | OPT_CALLBACK_F(0, "include", state, N_("path"), |
| 5207 | N_("apply changes matching the given path"), |
| 5208 | PARSE_OPT_NONEG, apply_option_parse_include), |
| 5209 | OPT_CALLBACK('p', NULL, state, N_("num"), |
| 5210 | N_("remove <num> leading slashes from traditional diff paths"), |
| 5211 | apply_option_parse_p), |
| 5212 | OPT_BOOL(0, "no-add", &state->no_add, |
| 5213 | N_("ignore additions made by the patch")), |
| 5214 | OPT_BOOL(0, "stat", &state->diffstat, |
| 5215 | N_("instead of applying the patch, output diffstat for the input")), |
| 5216 | OPT_NOOP_NOARG(0, "allow-binary-replacement"), |
| 5217 | OPT_NOOP_NOARG(0, "binary"), |
| 5218 | OPT_BOOL(0, "numstat", &state->numstat, |
| 5219 | N_("show number of added and deleted lines in decimal notation")), |
| 5220 | OPT_BOOL(0, "summary", &state->summary, |
| 5221 | N_("instead of applying the patch, output a summary for the input")), |
| 5222 | OPT_BOOL(0, "check", &state->check, |
| 5223 | N_("instead of applying the patch, see if the patch is applicable")), |
| 5224 | OPT_BOOL(0, "index", &state->check_index, |
| 5225 | N_("make sure the patch is applicable to the current index")), |
| 5226 | OPT_BOOL('N', "intent-to-add", &state->ita_only, |
| 5227 | N_("mark new files with `git add --intent-to-add`")), |
| 5228 | OPT_BOOL(0, "cached", &state->cached, |
| 5229 | N_("apply a patch without touching the working tree")), |
| 5230 | OPT_BOOL_F(0, "unsafe-paths", &state->unsafe_paths, |
| 5231 | N_("accept a patch that touches outside the working area"), |
| 5232 | PARSE_OPT_NOCOMPLETE), |
| 5233 | OPT_BOOL(0, "apply", force_apply, |
| 5234 | N_("also apply the patch (use with --stat/--summary/--check)")), |
| 5235 | OPT_BOOL('3', "3way", &state->threeway, |
| 5236 | N_( "attempt three-way merge, fall back on normal patch if that fails")), |
| 5237 | OPT_SET_INT_F(0, "ours", &state->merge_variant, |
| 5238 | N_("for conflicts, use our version"), |
| 5239 | XDL_MERGE_FAVOR_OURS, PARSE_OPT_NONEG), |
| 5240 | OPT_SET_INT_F(0, "theirs", &state->merge_variant, |
| 5241 | N_("for conflicts, use their version"), |
| 5242 | XDL_MERGE_FAVOR_THEIRS, PARSE_OPT_NONEG), |
| 5243 | OPT_SET_INT_F(0, "union", &state->merge_variant, |
| 5244 | N_("for conflicts, use a union version"), |
| 5245 | XDL_MERGE_FAVOR_UNION, PARSE_OPT_NONEG), |
| 5246 | OPT_FILENAME(0, "build-fake-ancestor", &state->fake_ancestor, |
| 5247 | N_("build a temporary index based on embedded index information")), |
| 5248 | /* Think twice before adding "--nul" synonym to this */ |
| 5249 | OPT_SET_INT('z', NULL, &state->line_termination, |
| 5250 | N_("paths are separated with NUL character"), '\0'), |
| 5251 | OPT_UNSIGNED('C', NULL, &state->p_context, |
| 5252 | N_("ensure at least <n> lines of context match")), |
| 5253 | OPT_CALLBACK(0, "whitespace", state, N_("action"), |
| 5254 | N_("detect new or modified lines that have whitespace errors"), |
no test coverage detected