]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-bisect.sh
Use new HASHMAP_INIT macro to simplify hashmap initialization
[thirdparty/git.git] / git-bisect.sh
index c28e35b0fa8039f9d9ccf0925c1e17ac79c70dbe..ea7e684ebb55481b8118adaab6dd2324cf7bf3e8 100755 (executable)
@@ -3,7 +3,7 @@
 USAGE='[help|start|bad|good|new|old|terms|skip|next|reset|visualize|view|replay|log|run]'
 LONG_USAGE='git bisect help
        print this long help message.
-git bisect start [--term-{old,good}=<term> --term-{new,bad}=<term>]
+git bisect start [--term-{new,bad}=<term> --term-{old,good}=<term>]
                 [--no-checkout] [--first-parent] [<bad> [<good>...]] [--] [<pathspec>...]
        reset bisect state and start bisection.
 git bisect (bad|new) [<rev>]
@@ -49,27 +49,6 @@ bisect_head()
        fi
 }
 
-bisect_autostart() {
-       test -s "$GIT_DIR/BISECT_START" || {
-               gettextln "You need to start by \"git bisect start\"" >&2
-               if test -t 0
-               then
-                       # TRANSLATORS: Make sure to include [Y] and [n] in your
-                       # translation. The program will only accept English input
-                       # at this point.
-                       gettext "Do you want me to do it for you [Y/n]? " >&2
-                       read yesno
-                       case "$yesno" in
-                       [Nn]*)
-                               exit ;;
-                       esac
-                       bisect_start
-               else
-                       exit 1
-               fi
-       }
-}
-
 bisect_start() {
        git bisect--helper --bisect-start $@ || exit
 
@@ -86,8 +65,7 @@ bisect_start() {
        #
        # Check if we can proceed to the next bisect state.
        #
-       get_terms
-       bisect_auto_next
+       git bisect--helper --bisect-auto-next || exit
 
        trap '-' 0
 }
@@ -108,7 +86,7 @@ bisect_skip() {
 }
 
 bisect_state() {
-       bisect_autostart
+       git bisect--helper --bisect-autostart || exit
        state=$1
        git bisect--helper --check-and-set-terms $state $TERM_GOOD $TERM_BAD || exit
        get_terms
@@ -140,45 +118,7 @@ bisect_state() {
        *)
                usage ;;
        esac
-       bisect_auto_next
-}
-
-bisect_auto_next() {
-       git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD && bisect_next || :
-}
-
-bisect_next() {
-       case "$#" in 0) ;; *) usage ;; esac
-       bisect_autostart
-       git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD $TERM_GOOD|| exit
-
-       # Perform all bisection computation, display and checkout
-       git bisect--helper --next-all
-       res=$?
-
-       # Check if we should exit because bisection is finished
-       if test $res -eq 10
-       then
-               bad_rev=$(git show-ref --hash --verify refs/bisect/$TERM_BAD)
-               bad_commit=$(git show-branch $bad_rev)
-               echo "# first $TERM_BAD commit: $bad_commit" >>"$GIT_DIR/BISECT_LOG"
-               exit 0
-       elif test $res -eq 2
-       then
-               echo "# only skipped commits left to test" >>"$GIT_DIR/BISECT_LOG"
-               good_revs=$(git for-each-ref --format="%(objectname)" "refs/bisect/$TERM_GOOD-*")
-               for skipped in $(git rev-list refs/bisect/$TERM_BAD --not $good_revs)
-               do
-                       skipped_commit=$(git show-branch $skipped)
-                       echo "# possible first $TERM_BAD commit: $skipped_commit" >>"$GIT_DIR/BISECT_LOG"
-               done
-               exit $res
-       fi
-
-       # Check for an error in the bisection process
-       test $res -ne 0 && exit $res
-
-       return 0
+       git bisect--helper --bisect-auto-next
 }
 
 bisect_visualize() {
@@ -234,7 +174,7 @@ bisect_replay () {
                esac
        done <"$file"
        IFS="$oIFS"
-       bisect_auto_next
+       git bisect--helper --bisect-auto-next || exit
 }
 
 bisect_run () {
@@ -331,7 +271,7 @@ case "$#" in
                bisect_skip "$@" ;;
        next)
                # Not sure we want "next" at the UI level anymore.
-               bisect_next "$@" ;;
+               git bisect--helper --bisect-next "$@" || exit ;;
        visualize|view)
                bisect_visualize "$@" ;;
        reset)