repo_config(the_repository, git_default_config, NULL);
argc = parse_options(argc, argv, prefix, options, git_notes_usage,
- PARSE_OPT_SUBCOMMAND_OPTIONAL);
- if (!fn) {
- if (argc) {
- error(_("unknown subcommand: `%s'"), argv[0]);
- usage_with_options(git_notes_usage, options);
- }
+ PARSE_OPT_SUBCOMMAND_OPTIONAL |
+ PARSE_OPT_SUBCOMMAND_AUTOCORR);
+ if (!fn)
fn = list;
- }
if (override_notes_ref) {
struct strbuf sb = STRBUF_INIT;
};
argc = parse_options(argc, argv, prefix, options, builtin_remote_usage,
- PARSE_OPT_SUBCOMMAND_OPTIONAL);
+ PARSE_OPT_SUBCOMMAND_OPTIONAL |
+ PARSE_OPT_SUBCOMMAND_AUTOCORR);
- if (fn) {
+ if (fn)
return !!fn(argc, argv, prefix, repo);
- } else {
- if (argc) {
- error(_("unknown subcommand: `%s'"), argv[0]);
- usage_with_options(builtin_remote_usage, options);
- }
+ else
return !!show_all();
- }
}
if (!err)
return PARSE_OPT_SUBCOMMAND;
- /*
- * arg is neither a short or long option nor a subcommand. Since this
- * command has a default operation mode, we have to treat this arg and
- * all remaining args as args meant to that default operation mode.
- * So we are done parsing.
- */
- if (ctx->flags & PARSE_OPT_SUBCOMMAND_OPTIONAL)
+ if (ctx->flags & PARSE_OPT_SUBCOMMAND_OPTIONAL &&
+ !(ctx->flags & PARSE_OPT_SUBCOMMAND_AUTOCORR)) {
+ /*
+ * arg is neither a short or long option nor a subcommand.
+ * Since this command has a default operation mode, we have to
+ * treat this arg and all remaining args as args meant to that
+ * default operation mode. So we are done parsing.
+ */
return PARSE_OPT_DONE;
+ }
find_subcommands(&cmds, options);
assumed = autocorrect_subcommand(arg, &cmds);
PARSE_OPT_ONE_SHOT = 1 << 5,
PARSE_OPT_SHELL_EVAL = 1 << 6,
PARSE_OPT_SUBCOMMAND_OPTIONAL = 1 << 7,
+ PARSE_OPT_SUBCOMMAND_AUTOCORR = 1 << 8,
};
enum parse_opt_option_flags {