diff mbox series

[07/13] format-patch: mark "--no-numbered" option with NONEG

Message ID 20181105064112.GG25864@sigill.intra.peff.net (mailing list archive)
State New, archived
Headers show
Series parseopt fixes from -Wunused-parameters | expand

Commit Message

Jeff King Nov. 5, 2018, 6:41 a.m. UTC
We have separate parse-options entries for "numbered" and "no-numbered",
which means that we accept "--no-no-numbered". It does not behave
sensibly, though (it ignores the "unset" flag and acts like
"--no-numbered").

We could fix that, but obviously this is silly and unintentional. Let's
just disallow it.

Signed-off-by: Jeff King <peff@peff.net>
---
 builtin/log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/builtin/log.c b/builtin/log.c
index 061d4fd864..41188e723c 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -1508,7 +1508,7 @@  int cmd_format_patch(int argc, const char **argv, const char *prefix)
 			    PARSE_OPT_NOARG, numbered_callback },
 		{ OPTION_CALLBACK, 'N', "no-numbered", &numbered, NULL,
 			    N_("use [PATCH] even with multiple patches"),
-			    PARSE_OPT_NOARG, no_numbered_callback },
+			    PARSE_OPT_NOARG | PARSE_OPT_NONEG, no_numbered_callback },
 		OPT_BOOL('s', "signoff", &do_signoff, N_("add Signed-off-by:")),
 		OPT_BOOL(0, "stdout", &use_stdout,
 			    N_("print patches to standard out")),