diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-10-25 16:06:59 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-10-25 16:06:59 -0700 |
commit | 65ca3245f99e3595ac483e4af5b2ff34b7985635 (patch) | |
tree | 7847c20152b9212a6b9e53db5fc6ba6a3966f92c /builtin | |
parent | Merge branch 'js/userdiff-cpp' (diff) | |
parent | parse-options: change OPT_{SHORT,UNSET} to an enum (diff) | |
download | tgif-65ca3245f99e3595ac483e4af5b2ff34b7985635.tar.xz |
Merge branch 'ab/parse-options-cleanup'
Random changes to parse-options implementation.
* ab/parse-options-cleanup:
parse-options: change OPT_{SHORT,UNSET} to an enum
parse-options tests: test optname() output
parse-options.[ch]: make opt{bug,name}() "static"
commit-graph: stop using optname()
parse-options.c: move optname() earlier in the file
parse-options.h: make the "flags" in "struct option" an enum
parse-options.c: use exhaustive "case" arms for "enum parse_opt_result"
parse-options.[ch]: consistently use "enum parse_opt_result"
parse-options.[ch]: consistently use "enum parse_opt_flags"
parse-options.h: move PARSE_OPT_SHELL_EVAL between enums
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/blame.c | 3 | ||||
-rw-r--r-- | builtin/commit-graph.c | 4 | ||||
-rw-r--r-- | builtin/shortlog.c | 3 |
3 files changed, 8 insertions, 2 deletions
diff --git a/builtin/blame.c b/builtin/blame.c index 1c31a99640..f9ee3f8c68 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -913,6 +913,9 @@ int cmd_blame(int argc, const char **argv, const char *prefix) PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_ARGV0); for (;;) { switch (parse_options_step(&ctx, options, blame_opt_usage)) { + case PARSE_OPT_NON_OPTION: + case PARSE_OPT_UNKNOWN: + break; case PARSE_OPT_HELP: case PARSE_OPT_ERROR: exit(129); diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c index 3c3de3a156..ab8e5cd59a 100644 --- a/builtin/commit-graph.c +++ b/builtin/commit-graph.c @@ -172,8 +172,8 @@ static int write_option_max_new_filters(const struct option *opt, const char *s; *to = strtol(arg, (char **)&s, 10); if (*s) - return error(_("%s expects a numerical value"), - optname(opt, opt->flags)); + return error(_("option `%s' expects a numerical value"), + "max-new-filters"); } return 0; } diff --git a/builtin/shortlog.c b/builtin/shortlog.c index 3e7ab1ca82..e7f7af5de3 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -374,6 +374,9 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix) for (;;) { switch (parse_options_step(&ctx, options, shortlog_usage)) { + case PARSE_OPT_NON_OPTION: + case PARSE_OPT_UNKNOWN: + break; case PARSE_OPT_HELP: case PARSE_OPT_ERROR: exit(129); |