]> git.ipfire.org Git - thirdparty/git.git/commitdiff
grep: reject --no-or
authorRené Scharfe <l.s.r@web.de>
Thu, 7 Sep 2023 20:20:59 +0000 (22:20 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 Sep 2023 20:35:07 +0000 (13:35 -0700)
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.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/grep.c

index f7821c5fbbaeda3888f3011ee5215393e1319952..3486cb924496eae45b8947eaf0e19d09b12a9148 100644 (file)
@@ -976,7 +976,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, "",