summaryrefslogtreecommitdiff
path: root/builtin/cat-file.c
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2018-11-05 01:40:10 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-11-06 12:55:35 +0900
commit0ad1efb4b379b4d47166c04b3103c6ead3a79673 (patch)
treeebc2f398a514a42aaa7b2d156faed54f5280188a /builtin/cat-file.c
parentpack-objects: mark index-version option as NONEG (diff)
downloadtgif-0ad1efb4b379b4d47166c04b3103c6ead3a79673.tar.xz
cat-file: mark batch options with NONEG
Running "cat-file --no-batch" will behave as if "--batch" was given, since the option callback does not handle the "unset" flag (likewise for "--no-batch-check"). In theory this might be used to cancel an earlier --batch, but it's not immediately obvious how that would interact with --batch-check. Let's just disallow the negated form of both options. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/cat-file.c')
-rw-r--r--builtin/cat-file.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 8d97c84725..4a5289079c 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -631,10 +631,12 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)
OPT_BOOL(0, "buffer", &batch.buffer_output, N_("buffer --batch output")),
{ OPTION_CALLBACK, 0, "batch", &batch, "format",
N_("show info and content of objects fed from the standard input"),
- PARSE_OPT_OPTARG, batch_option_callback },
+ PARSE_OPT_OPTARG | PARSE_OPT_NONEG,
+ batch_option_callback },
{ OPTION_CALLBACK, 0, "batch-check", &batch, "format",
N_("show info about objects fed from the standard input"),
- PARSE_OPT_OPTARG, batch_option_callback },
+ PARSE_OPT_OPTARG | PARSE_OPT_NONEG,
+ batch_option_callback },
OPT_BOOL(0, "follow-symlinks", &batch.follow_symlinks,
N_("follow in-tree symlinks (used with --batch or --batch-check)")),
OPT_BOOL(0, "batch-all-objects", &batch.all_objects,