{"thread":{"id":"60205","subject":"[PATCH] grep: reject --no-or","startedAt":"2023-09-07T20:21:13Z","lastAt":"2023-09-07T20:35:06Z","messageCount":2,"participants":["René Scharfe","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"481515","messageId":"6aeb0ebe-0fea-ccd3-089a-ee0b5b5baf10@web.de","threadId":"60205","inReplyTo":null,"subject":"[PATCH] grep: reject --no-or","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2023-09-07T20:20:59Z","receivedAt":"2023-09-07T20:21:13Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Since 3e230fa1b2 (grep: use parseopt, 2009-05-07) git grep has been\naccepting the option --no-or.  It does the same as --or: nothing.\nThat's confusing and unintended.  Forbid negating --or.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\n builtin/grep.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 50e712a184..2a261074f1 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -990,7 +990,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)\n \t\tOPT_CALLBACK_F(0, \"and\", &opt, NULL,\n \t\t\tN_(\"combine patterns specified with -e\"),\n \t\t\tPARSE_OPT_NOARG | PARSE_OPT_NONEG, and_callback),\n-\t\tOPT_BOOL(0, \"or\", &dummy, \"\"),\n+\t\tOPT_BOOL_F(0, \"or\", &dummy, \"\", PARSE_OPT_NONEG),\n \t\tOPT_CALLBACK_F(0, \"not\", &opt, NULL, \"\",\n \t\t\tPARSE_OPT_NOARG | PARSE_OPT_NONEG, not_callback),\n \t\tOPT_CALLBACK_F('(', NULL, &opt, NULL, \"\",\n--\n2.42.0\n"},{"id":"481519","messageId":"xmqqh6o5k9ht.fsf@gitster.g","threadId":"60205","inReplyTo":"6aeb0ebe-0fea-ccd3-089a-ee0b5b5baf10@web.de","subject":"Re: [PATCH] grep: reject --no-or","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-09-07T20:34:54Z","receivedAt":"2023-09-07T20:35:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"René Scharfe <l.s.r@web.de> writes:\n\n> Since 3e230fa1b2 (grep: use parseopt, 2009-05-07) git grep has been\n> accepting the option --no-or.  It does the same as --or: nothing.\n> That's confusing and unintended.  Forbid negating --or.\n\nOK.  It is just a no-op Boolean but that is not a good reason for us\nto be loose.  Will queue.  Thanks.\n\n>\n> Signed-off-by: René Scharfe <l.s.r@web.de>\n> ---\n>  builtin/grep.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/builtin/grep.c b/builtin/grep.c\n> index 50e712a184..2a261074f1 100644\n> --- a/builtin/grep.c\n> +++ b/builtin/grep.c\n> @@ -990,7 +990,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)\n>  \t\tOPT_CALLBACK_F(0, \"and\", &opt, NULL,\n>  \t\t\tN_(\"combine patterns specified with -e\"),\n>  \t\t\tPARSE_OPT_NOARG | PARSE_OPT_NONEG, and_callback),\n> -\t\tOPT_BOOL(0, \"or\", &dummy, \"\"),\n> +\t\tOPT_BOOL_F(0, \"or\", &dummy, \"\", PARSE_OPT_NONEG),\n>  \t\tOPT_CALLBACK_F(0, \"not\", &opt, NULL, \"\",\n>  \t\t\tPARSE_OPT_NOARG | PARSE_OPT_NONEG, not_callback),\n>  \t\tOPT_CALLBACK_F('(', NULL, &opt, NULL, \"\",\n> --\n> 2.42.0\n"}]}