@@ -1348,10 +1348,12 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
struct bisect_terms terms = { .term_good = NULL, .term_bad = NULL };
argc = parse_options(argc, argv, prefix, options, git_bisect_usage,
- 0);
+ PARSE_OPT_SUBCOMMAND_OPTIONAL);
- argc--;
- argv++;
+ if (fn) {
+ argc--;
+ argv++;
+ }
if (fn == bisect_reset) {
if (argc > 1)
@@ -1386,6 +1388,19 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
get_terms(&terms);
}
+ if (!fn) {
+ if (!argc)
+ usage_msg_opt(_("need a command"), git_bisect_usage,
+ options);
+
+ set_terms(&terms, "bad", "good");
+ get_terms(&terms);
+ if (check_and_set_terms(&terms, argv[0]))
+ usage_msg_optf(_("unknown command: '%s'"),
+ git_bisect_usage, options, argv[0]);
+ fn = bisect_state;
+ }
+
res = fn(&terms, argc, argv, prefix);
free_terms(&terms);
@@ -34,33 +34,18 @@ Please use "git help bisect" to get the full man page.'
OPTIONS_SPEC=
. git-sh-setup
-TERM_BAD=bad
-TERM_GOOD=good
-
-get_terms () {
- if test -s "$GIT_DIR/BISECT_TERMS"
- then
- {
- read TERM_BAD
- read TERM_GOOD
- } <"$GIT_DIR/BISECT_TERMS"
- fi
-}
case "$#" in
0)
usage ;;
*)
cmd="$1"
- get_terms
shift
case "$cmd" in
help)
git bisect -h ;;
start)
git bisect--helper start "$@" ;;
- bad|good|new|old|"$TERM_BAD"|"$TERM_GOOD")
- git bisect--helper state "$cmd" "$@" ;;
skip)
git bisect--helper skip "$@" || exit;;
next)
@@ -79,6 +64,6 @@ case "$#" in
terms)
git bisect--helper terms "$@" || exit;;
*)
- usage ;;
+ git bisect--helper "$cmd" "$@" ;;
esac
esac