summaryrefslogtreecommitdiff
path: root/git-bisect.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-09-23 20:44:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-09-23 20:44:48 (GMT)
commit0a4cb1f1f2f64e5f3791809284ba786a8094dfb4 (patch)
tree17d029ca760431634ca1acd93472065ee63ddeaa /git-bisect.sh
parent57e4a7b633d00f274051d436edcec14ad98969c3 (diff)
parent911aba1420522991f9d79cec42d0cb957d2ba00a (diff)
downloadgit-0a4cb1f1f2f64e5f3791809284ba786a8094dfb4.zip
git-0a4cb1f1f2f64e5f3791809284ba786a8094dfb4.tar.gz
git-0a4cb1f1f2f64e5f3791809284ba786a8094dfb4.tar.bz2
Merge branch 'mr/bisect-in-c-4'
Rewrite of "git bisect" in C continues. * mr/bisect-in-c-4: bisect--helper: retire `--bisect-next-check` subcommand bisect--helper: reimplement `bisect_run` shell function in C bisect--helper: reimplement `bisect_visualize()` shell function in C run-command: make `exists_in_PATH()` non-static t6030-bisect-porcelain: add test for bisect visualize t6030-bisect-porcelain: add tests to control bisect run exit cases
Diffstat (limited to 'git-bisect.sh')
-rwxr-xr-xgit-bisect.sh87
1 files changed, 2 insertions, 85 deletions
diff --git a/git-bisect.sh b/git-bisect.sh
index b59f3aa..405cf76 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -37,89 +37,6 @@ OPTIONS_SPEC=
TERM_BAD=bad
TERM_GOOD=good
-bisect_visualize() {
- git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD fail || exit
-
- if test $# = 0
- then
- if test -n "${DISPLAY+set}${SESSIONNAME+set}${MSYSTEM+set}${SECURITYSESSIONID+set}" &&
- type gitk >/dev/null 2>&1
- then
- set gitk
- else
- set git log
- fi
- else
- case "$1" in
- git*|tig) ;;
- -*) set git log "$@" ;;
- *) set git "$@" ;;
- esac
- fi
-
- eval '"$@"' --bisect -- $(cat "$GIT_DIR/BISECT_NAMES")
-}
-
-bisect_run () {
- git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD fail || exit
-
- test -n "$*" || die "$(gettext "bisect run failed: no command provided.")"
-
- while true
- do
- command="$@"
- eval_gettextln "running \$command"
- "$@"
- res=$?
-
- # Check for really bad run error.
- if [ $res -lt 0 -o $res -ge 128 ]
- then
- eval_gettextln "bisect run failed:
-exit code \$res from '\$command' is < 0 or >= 128" >&2
- exit $res
- fi
-
- # Find current state depending on run success or failure.
- # A special exit code of 125 means cannot test.
- if [ $res -eq 125 ]
- then
- state='skip'
- elif [ $res -gt 0 ]
- then
- state="$TERM_BAD"
- else
- state="$TERM_GOOD"
- fi
-
- git bisect--helper --bisect-state $state >"$GIT_DIR/BISECT_RUN"
- res=$?
-
- cat "$GIT_DIR/BISECT_RUN"
-
- if sane_grep "first $TERM_BAD commit could be any of" "$GIT_DIR/BISECT_RUN" \
- >/dev/null
- then
- gettextln "bisect run cannot continue any more" >&2
- exit $res
- fi
-
- if [ $res -ne 0 ]
- then
- eval_gettextln "bisect run failed:
-'bisect-state \$state' exited with error code \$res" >&2
- exit $res
- fi
-
- if sane_grep "is the first $TERM_BAD commit" "$GIT_DIR/BISECT_RUN" >/dev/null
- then
- gettextln "bisect run success"
- exit 0;
- fi
-
- done
-}
-
get_terms () {
if test -s "$GIT_DIR/BISECT_TERMS"
then
@@ -150,7 +67,7 @@ case "$#" in
# Not sure we want "next" at the UI level anymore.
git bisect--helper --bisect-next "$@" || exit ;;
visualize|view)
- bisect_visualize "$@" ;;
+ git bisect--helper --bisect-visualize "$@" || exit;;
reset)
git bisect--helper --bisect-reset "$@" ;;
replay)
@@ -158,7 +75,7 @@ case "$#" in
log)
git bisect--helper --bisect-log || exit ;;
run)
- bisect_run "$@" ;;
+ git bisect--helper --bisect-run "$@" || exit;;
terms)
git bisect--helper --bisect-terms "$@" || exit;;
*)