apply: mark include/exclude options as NONEG

The options callback for "git apply --no-include" is not ready to handle the "unset" parameter, and as a result will segfault when it adds a NULL argument to the include list (likewise for "--no-exclude"). In theory this might be used to clear the list, but since both "--include" and "--exclude" add to the same list, it's not immediately obvious what the semantics should be. Let's punt on that for now and just disallow the broken options. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Nov 5, 2018 at 01:38 UTC d5d202537f2cfec41304b559624b4cc0a2d8c9fe
1 file changed +2 -2
apply.c
+2 -2
@@ -4939,10 +4939,10 @@ int apply_parse_options(int argc, const char **argv,
4939 struct option builtin_apply_options[] = {
4940 { OPTION_CALLBACK, 0, "exclude", state, N_("path"),
4941 N_("don't apply changes matching the given path"),
4942 - 0, apply_option_parse_exclude },
4942 + PARSE_OPT_NONEG, apply_option_parse_exclude },
4943 { OPTION_CALLBACK, 0, "include", state, N_("path"),
4944 N_("apply changes matching the given path"),
4945 - 0, apply_option_parse_include },
4945 + PARSE_OPT_NONEG, apply_option_parse_include },
4946 { OPTION_CALLBACK, 'p', NULL, state, N_("num"),
4947 N_("remove <num> leading slashes from traditional diff paths"),
4948 0, apply_option_parse_p },