From 0eb8d3767c8f5c87f3bdcbbf9d3d5f73c39422d9 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 5 Nov 2018 01:43:44 -0500 Subject: cat-file: report an error on multiple --batch options The options callback for --batch and --batch-check detects when the two mutually incompatible options are used. But it simply returns an error code to parse-options, meaning the program will quit without any kind of message to the user. Instead, let's use error() to print something and return -1. Note that this flips the error return from 1 to -1, but negative values are more idiomatic here (and parse-options treats them the same). Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/cat-file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin/cat-file.c') diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 4a5289079c..0f6b692df6 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -596,7 +596,7 @@ static int batch_option_callback(const struct option *opt, struct batch_options *bo = opt->value; if (bo->enabled) { - return 1; + return error(_("only one batch option may be specified")); } bo->enabled = 1; -- cgit v1.2.3