@@ -26,8 +26,8 @@ static const char * const git_bisect_helper_usage[] = {
N_("git bisect--helper --bisect-start [--term-{new,bad}=<term> --term-{old,good}=<term>]"
" [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] [<paths>...]"),
N_("git bisect--helper --bisect-next"),
- N_("git bisect--helper --bisect-state (bad|new) [<rev>]"),
- N_("git bisect--helper --bisect-state (good|old) [<rev>...]"),
+ N_("git bisect--helper [--bisect-state] (bad|new) [<rev>]"),
+ N_("git bisect--helper [--bisect-state] (good|old) [<rev>...]"),
N_("git bisect--helper --bisect-replay <filename>"),
N_("git bisect--helper --bisect-skip [(<rev>|<range>)...]"),
N_("git bisect--helper --bisect-visualize"),
@@ -1210,10 +1210,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
git_bisect_helper_usage,
PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_UNKNOWN);
- if (!cmdmode)
- usage_with_options(git_bisect_helper_usage, options);
-
- switch (cmdmode) {
+ switch (cmdmode ? cmdmode : BISECT_STATE) {
case BISECT_START:
set_terms(&terms, "bad", "good");
res = bisect_start(&terms, argv, argc);
@@ -1221,6 +1218,11 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
case BISECT_STATE:
set_terms(&terms, "bad", "good");
get_terms(&terms);
+ if (!cmdmode &&
+ (!argc || check_and_set_terms(&terms, argv[0]))) {
+ char *msg = xstrfmt(_("unknown command: '%s'"), argv[0]);
+ usage_msg_opt(msg, git_bisect_helper_usage, options);
+ }
res = bisect_state(&terms, argv, argc);
break;
case BISECT_TERMS:
@@ -60,7 +60,7 @@ case "$#" in
start)
git bisect--helper --bisect-start "$@" ;;
bad|good|new|old|"$TERM_BAD"|"$TERM_GOOD")
- git bisect--helper --bisect-state "$cmd" "$@" ;;
+ git bisect--helper "$cmd" "$@" ;;
skip)
git bisect--helper --bisect-skip "$@" || exit;;
next)