aboutsummaryrefslogtreecommitdiffstats
path: root/t/helper
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-09-13 11:38:24 -0700
committerJunio C Hamano <gitster@pobox.com>2022-09-13 11:38:24 -0700
commit76ffa818c792cf3508502f78909c3b7eb3c72dbc (patch)
treea8df035dcafeea7c95ee6405b0bdd536a2393b75 /t/helper
parentMerge branch 'jk/rev-list-verify-objects-fix' (diff)
parentnotes, remote: show unknown subcommands between `' (diff)
downloadgit-76ffa818c792cf3508502f78909c3b7eb3c72dbc.tar.gz
git-76ffa818c792cf3508502f78909c3b7eb3c72dbc.zip
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.c7
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);
}