diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-09-13 21:38:24 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-09-13 21:38:24 +0300 |
commit | 76ffa818c792cf3508502f78909c3b7eb3c72dbc (patch) | |
tree | a8df035dcafeea7c95ee6405b0bdd536a2393b75 /t/helper | |
parent | 655e49404792a302b16fa640e1fa6041052996f9 (diff) | |
parent | dd834d75caabd436e306c136f753c801220db2df (diff) |
Merge branch 'sg/parse-options-subcommand'
The codepath for the OPT_SUBCOMMAND facility has been cleaned up.
* sg/parse-options-subcommand:
notes, remote: show unknown subcommands between `'
notes: simplify default operation mode arguments check
test-parse-options.c: fix style of comparison with zero
test-parse-options.c: don't use for loop initial declaration
t0040-parse-options: remove leftover debugging
Diffstat (limited to 't/helper')
-rw-r--r-- | t/helper/test-parse-options.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c index aa0ad45851..506835521a 100644 --- a/t/helper/test-parse-options.c +++ b/t/helper/test-parse-options.c @@ -195,7 +195,8 @@ int cmd__parse_options(int argc, const char **argv) static void print_args(int argc, const char **argv) { - for (int i = 0; i < argc; i++) + int i; + for (i = 0; i < argc; i++) printf("arg %02d: %s\n", i, argv[i]); } @@ -254,7 +255,7 @@ int cmd__parse_options_flags(int argc, const char **argv) argc = parse_options(argc, argv, NULL, test_flag_options, usage, PARSE_OPT_STOP_AT_NON_OPTION); - if (argc == 0 || strcmp(argv[0], "cmd")) { + if (!argc || strcmp(argv[0], "cmd")) { error("'cmd' is mandatory"); usage_with_options(usage, test_flag_options); } @@ -312,7 +313,7 @@ int cmd__parse_subcommand(int argc, const char **argv) argc = parse_options(argc, argv, NULL, test_flag_options, usage, PARSE_OPT_STOP_AT_NON_OPTION); - if (argc == 0 || strcmp(argv[0], "cmd")) { + if (!argc || strcmp(argv[0], "cmd")) { error("'cmd' is mandatory"); usage_with_options(usage, test_flag_options); } |