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

[PATCH 04/13] pack-objects: mark index-version option as NONEG

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

Running "git pack-objects --no-index-version" will segfault, since the callback is not prepared to handle the "unset" flag.

In theory this might be used to counteract an earlier "--index-version", or override a pack.indexversion config setting. But the semantics aren't immediately obvious, and it's unlikely anybody wants this. Let's just disable the broken option for now.

Signed-off-by: Jeff King <peff@peff.net>
---
 builtin/pack-objects.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index e50c6cd1ff..4eac2f997b 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -3252,7 +3252,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
 			 N_("similar to --all-progress when progress meter is shown")),
 		{ OPTION_CALLBACK, 0, "index-version", NULL, N_("<version>[,<offset>]"),
 		  N_("write the pack index file in the specified idx format version"),
-		  0, option_parse_index_version },
+		  PARSE_OPT_NONEG, option_parse_index_version },
 		OPT_MAGNITUDE(0, "max-pack-size", &pack_size_limit,
 			      N_("maximum size of each output pack file")),
 		OPT_BOOL(0, "local", &local,
-- 
2.19.1.1505.g9cd28186cf
Previous: Jeff KingNext: Jeff King
Message 7 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.