}
if (oldlines || newlines)
return -1;
- if (!deleted && !added)
+ if (!patch->recount && !deleted && !added)
return -1;
fragment->leading = leading;
const char *arg, int unset)
{
struct apply_state *state = opt->value;
+
+ BUG_ON_OPT_NEG(unset);
+
add_name_limit(state, arg, 1);
return 0;
}
const char *arg, int unset)
{
struct apply_state *state = opt->value;
+
+ BUG_ON_OPT_NEG(unset);
+
add_name_limit(state, arg, 0);
state->has_include = 1;
return 0;
int unset)
{
struct apply_state *state = opt->value;
+
+ BUG_ON_OPT_NEG(unset);
+
state->p_value = atoi(arg);
state->p_value_known = 1;
return 0;
const char *arg, int unset)
{
struct apply_state *state = opt->value;
+
+ BUG_ON_OPT_ARG(arg);
+
if (unset)
state->ws_ignore_action = ignore_ws_none;
else
const char *arg, int unset)
{
struct apply_state *state = opt->value;
+
+ BUG_ON_OPT_NEG(unset);
+
state->whitespace_option = arg;
if (parse_whitespace_option(state, arg))
- exit(1);
+ return -1;
return 0;
}
const char *arg, int unset)
{
struct apply_state *state = opt->value;
+
+ BUG_ON_OPT_NEG(unset);
+
strbuf_reset(&state->root);
strbuf_addstr(&state->root, arg);
strbuf_complete(&state->root, '/');
struct option builtin_apply_options[] = {
{ OPTION_CALLBACK, 0, "exclude", state, N_("path"),
N_("don't apply changes matching the given path"),
- 0, apply_option_parse_exclude },
+ PARSE_OPT_NONEG, apply_option_parse_exclude },
{ OPTION_CALLBACK, 0, "include", state, N_("path"),
N_("apply changes matching the given path"),
- 0, apply_option_parse_include },
+ PARSE_OPT_NONEG, apply_option_parse_include },
{ OPTION_CALLBACK, 'p', NULL, state, N_("num"),
N_("remove <num> leading slashes from traditional diff paths"),
0, apply_option_parse_p },