We use PARSE_OPT_KEEP_ARGV0 when parsing the unit-test command line, so
argv[0] still contains the program name afterwards. If we find an extra
argument, though, we report argv[0] as the offending parameter. This makes
an invocation like "unit-tests foo" complain about "unit-tests" instead
of "foo".
Report argv[1] instead, which is the first argument we didn't consume.
Signed-off-by: Jeff King <redacted>
---
t/unit-tests/unit-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/unit-tests/unit-test.c b/t/unit-tests/unit-test.c
index 752fb38fb3..8eda87856c 100644
--- a/t/unit-tests/unit-test.c
+++ b/t/unit-tests/unit-test.c
@@ -48,7 +48,7 @@ int cmd_main(int argc, const char **argv)
argc = parse_options(argc, argv, NULL, options,
unit_test_usage, PARSE_OPT_KEEP_ARGV0);
if (argc > 1)
- usagef(_("extra command line parameter '%s'"), argv[0]);
+ usagef(_("extra command line parameter '%s'"), argv[1]);
strvec_push(&args, argv[0]);
strvec_push(&args, "-t");--
2.56.0.559.g7c1a1d8168