提交 0eb8d376 编写于 作者: J Jeff King 提交者: Junio C Hamano

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: NJeff King <peff@peff.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 1f5db32d
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册