git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] grep: reject --no-or

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 7, 2023, 20:34 UTC
Message-ID
<xmqqh6o5k9ht.fsf@gitster.g>
In-Reply-To
<6aeb0ebe-0fea-ccd3-089a-ee0b5b5baf10@web.de>
René Scharfe <l.s.r@web.de> writes:
> Since 3e230fa1b2 (grep: use parseopt, 2009-05-07) git grep has been
> accepting the option --no-or.  It does the same as --or: nothing.
> That's confusing and unintended.  Forbid negating --or.

OK. It is just a no-op Boolean but that is not a good reason for us to be loose. Will queue. Thanks.

Show 21 quoted lines
>
> Signed-off-by: René Scharfe <l.s.r@web.de>
> ---
>  builtin/grep.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/grep.c b/builtin/grep.c
> index 50e712a184..2a261074f1 100644
> --- a/builtin/grep.c
> +++ b/builtin/grep.c
> @@ -990,7 +990,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
>  		OPT_CALLBACK_F(0, "and", &opt, NULL,
>  			N_("combine patterns specified with -e"),
>  			PARSE_OPT_NOARG | PARSE_OPT_NONEG, and_callback),
> -		OPT_BOOL(0, "or", &dummy, ""),
> +		OPT_BOOL_F(0, "or", &dummy, "", PARSE_OPT_NONEG),
>  		OPT_CALLBACK_F(0, "not", &opt, NULL, "",
>  			PARSE_OPT_NOARG | PARSE_OPT_NONEG, not_callback),
>  		OPT_CALLBACK_F('(', NULL, &opt, NULL, "",
> --
> 2.42.0
Previous: René Scharfe
Message 2 of 2 in “grep: reject --no-or”
  1. grep: reject --no-orRené Scharfe, Sep 7, 2023
  2. Junio C HamanoSep 7, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.