@matheusbsbs / matheus-bagliano / commits / 26e28fe7bb
Fork 0

test-advise: check argument count with argc instead of argv

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>

Jeff King committed Sep 30, 2020 at 08:30 UTC 26e28fe7bbdf8b22ed096dfd76a9311e86ffb200
1 file changed +2 -2
t/helper/test-advise.c
+2 -2
@@ -5,8 +5,8 @@
5
6 int cmd__advise_if_enabled(int argc, const char **argv)
7 {
8 - if (!argv[1])
9 - die("usage: %s <advice>", argv[0]);
8 + if (argc != 2)
9 + die("usage: %s <advice>", argv[0]);
10
11 setup_git_directory();
12 git_config(git_default_config, NULL);