Skip to content

Commit 26e28fe

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 75d3bee commit 26e28fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

t/helper/test-advise.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
int cmd__advise_if_enabled(int argc, const char **argv)
77
{
8-
if (!argv[1])
9-
die("usage: %s <advice>", argv[0]);
8+
if (argc != 2)
9+
die("usage: %s <advice>", argv[0]);
1010

1111
setup_git_directory();
1212
git_config(git_default_config, NULL);

0 commit comments

Comments
 (0)