Skip to content

Commit 0eb8d37

Browse files
peffgitster
authored andcommitted
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>
1 parent 1f5db32 commit 0eb8d37

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/cat-file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ static int batch_option_callback(const struct option *opt,
596596
struct batch_options *bo = opt->value;
597597

598598
if (bo->enabled) {
599-
return 1;
599+
return error(_("only one batch option may be specified"));
600600
}
601601

602602
bo->enabled = 1;

0 commit comments

Comments
 (0)