summaryrefslogtreecommitdiff
path: root/builtin/cat-file.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-11-05 06:43:44 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-11-06 03:55:36 (GMT)
commit0eb8d3767c8f5c87f3bdcbbf9d3d5f73c39422d9 (patch)
tree4561e716a7b5816df4aeabae3c7c4882ce9af91c /builtin/cat-file.c
parent1f5db32d89b62317cf59486d14e8b2d4d004cd1e (diff)
downloadgit-0eb8d3767c8f5c87f3bdcbbf9d3d5f73c39422d9.zip
git-0eb8d3767c8f5c87f3bdcbbf9d3d5f73c39422d9.tar.gz
git-0eb8d3767c8f5c87f3bdcbbf9d3d5f73c39422d9.tar.bz2
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 <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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 4a52890..0f6b692 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;