]> git.ipfire.org Git - thirdparty/git.git/commitdiff
test-advise: check argument count with argc instead of argv
authorJeff King <peff@peff.net>
Wed, 30 Sep 2020 12:30:27 +0000 (08:30 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 30 Sep 2020 19:53:48 +0000 (12:53 -0700)
We complain if "test-tool advise" is not given an argument, but we
quietly ignore any additional arguments it receives. Let's instead check
that we got the expected number. As a bonus, this silences
-Wunused-parameter, which notes that we don't ever look at argc.

While we're here, we can also fix the indentation in the conditional.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/helper/test-advise.c

index 38cdc2884e1128f16b3e6214c3fef3e877d7a03e..a7043df1d38ad3e94c76390dc5c33157c72fc76d 100644 (file)
@@ -5,8 +5,8 @@
 
 int cmd__advise_if_enabled(int argc, const char **argv)
 {
-       if (!argv[1])
-       die("usage: %s <advice>", argv[0]);
+       if (argc != 2)
+               die("usage: %s <advice>", argv[0]);
 
        setup_git_directory();
        git_config(git_default_config, NULL);