From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 01/13] apply: mark include/exclude options as NONEG
Date: Mon, 05 Nov 2018 16:07:59 +0900 [thread overview]
Message-ID: <xmqqd0rkhui8.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20181105063819.GA25864@sigill.intra.peff.net> (Jeff King's message of "Mon, 5 Nov 2018 01:38:19 -0500")
Jeff King <peff@peff.net> writes:
> 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.
Thanks. I agree with the conclusion to leave it to later outside
this series to define what --no-(include|exclude) should do.
I suspect something along the lines of
Each element on the single list is marked as either include or
exclude, and "--no-include" would remove the accumulated
"include" entries in the list without touching any "exclude"
elements.
would be sufficiently clear and useful, perhaps.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> apply.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/apply.c b/apply.c
> index 073d5f0451..d1ca6addeb 100644
> --- a/apply.c
> +++ b/apply.c
> @@ -4939,10 +4939,10 @@ int apply_parse_options(int argc, const char **argv,
> 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 },
next prev parent reply other threads:[~2018-11-05 7:08 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-05 6:37 [PATCH 0/13] parseopt fixes from -Wunused-parameters Jeff King
2018-11-05 6:38 ` [PATCH 01/13] apply: mark include/exclude options as NONEG Jeff King
2018-11-05 7:07 ` Junio C Hamano [this message]
2018-11-05 6:38 ` [PATCH 02/13] am: handle --no-patch-format option Jeff King
2018-11-05 7:08 ` Junio C Hamano
2018-11-05 6:39 ` [PATCH 03/13] ls-files: mark exclude options as NONEG Jeff King
2018-11-05 6:39 ` [PATCH 04/13] pack-objects: mark index-version option " Jeff King
2018-11-05 6:40 ` [PATCH 05/13] cat-file: mark batch options with NONEG Jeff King
2018-11-05 6:40 ` [PATCH 06/13] status: mark --find-renames option " Jeff King
2018-11-05 6:41 ` [PATCH 07/13] format-patch: mark "--no-numbered" " Jeff King
2018-11-05 6:42 ` [PATCH 08/13] show-branch: mark --reflog option as NONEG Jeff King
2018-11-05 6:43 ` [PATCH 09/13] tag: mark "--message" option with NONEG Jeff King
2018-11-05 6:43 ` [PATCH 10/13] cat-file: report an error on multiple --batch options Jeff King
2018-11-05 6:43 ` [PATCH 11/13] apply: return -1 from option callback instead of calling exit(1) Jeff King
2018-11-05 6:44 ` [PATCH 12/13] parse-options: drop OPT_DATE() Jeff King
2018-11-05 18:34 ` [PATCH] parse-options: deprecate OPT_DATE Carlo Marcelo Arenas Belón
2018-11-05 18:49 ` Jeff King
2018-11-05 6:45 ` [PATCH 13/13] assert NOARG/NONEG behavior of parse-options callbacks Jeff King
2018-11-05 16:51 ` [PATCH 0/13] parseopt fixes from -Wunused-parameters Duy Nguyen
2018-11-05 18:49 ` Jeff King
2018-11-05 18:51 ` Duy Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqd0rkhui8.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).