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

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

From
Jeff King <peff@peff.net>
Date
Nov 5, 2018, 06:41 UTC
Message-ID
<20181105064112.GG25864@sigill.intra.peff.net>
In-Reply-To
<20181105063718.GA24877@sigill.intra.peff.net>

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 --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")),
-- 
2.19.1.1505.g9cd28186cf
Previous: Jeff KingNext: Jeff King
Message 10 of 21 in “parseopt fixes from -Wunused-parameters”
  1. 0/13 parseopt fixes from -Wunused-parametersJeff King, Nov 5, 2018
  2. 01/13 apply: mark include/exclude options as NONEGJeff King, Nov 5, 2018
  3. Junio C HamanoNov 5, 2018
  4. 02/13 am: handle --no-patch-format optionJeff King, Nov 5, 2018
  5. Junio C HamanoNov 5, 2018
  6. 03/13 ls-files: mark exclude options as NONEGJeff King, Nov 5, 2018
  7. 04/13 pack-objects: mark index-version option as NONEGJeff King, Nov 5, 2018
  8. 05/13 cat-file: mark batch options with NONEGJeff King, Nov 5, 2018
  9. 06/13 status: mark --find-renames option with NONEGJeff King, Nov 5, 2018
  10. 07/13 format-patch: mark "--no-numbered" option with NONEGJeff King, Nov 5, 2018
  11. 08/13 show-branch: mark --reflog option as NONEGJeff King, Nov 5, 2018
  12. 09/13 tag: mark "--message" option with NONEGJeff King, Nov 5, 2018
  13. 10/13 cat-file: report an error on multiple --batch optionsJeff King, Nov 5, 2018
  14. 11/13 apply: return -1 from option callback instead of calling exit(1)Jeff King, Nov 5, 2018
  15. 12/13 parse-options: drop OPT_DATE()Jeff King, Nov 5, 2018
  16. parse-options: deprecate OPT_DATECarlo Marcelo Arenas Belón, Nov 5, 2018
  17. Jeff KingNov 5, 2018
  18. 13/13 assert NOARG/NONEG behavior of parse-options callbacksJeff King, Nov 5, 2018
  19. Duy NguyenNov 5, 2018
  20. Jeff KingNov 5, 2018
  21. Duy NguyenNov 5, 2018

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.