diff options
author | Pranit Bauva <pranit.bauva@gmail.com> | 2019-01-02 16:38:34 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-01-02 19:23:02 +0100 |
commit | 129a6cf344c4b352433f5a24de02a62783f6c6df (patch) | |
tree | e24821ed51fd52a71ed5a21d699761b5915ff3f8 /git-bisect.sh | |
parent | bisect--helper: `check_and_set_terms` shell function in C (diff) | |
download | git-129a6cf344c4b352433f5a24de02a62783f6c6df.tar.xz git-129a6cf344c4b352433f5a24de02a62783f6c6df.zip |
bisect--helper: `bisect_next_check` shell function in C
Reimplement `bisect_next_check` shell function in C and add
`bisect-next-check` subcommand to `git bisect--helper` to call it from
git-bisect.sh .
`bisect_voc` shell function is no longer useful now and is replaced by
using a char *[] of "new|bad" and "good|old" values.
Using `--bisect-next-check` is a temporary measure to port shell
function to C so as to use the existing test suite. As more functions
are ported, this subcommand will be retired but its implementation will
be called by some other methods.
Helped-by: Stephan Beyer <s-beyer@gmx.net>
Mentored-by: Lars Schneider <larsxschneider@gmail.com>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
Signed-off-by: Tanushree Tumane <tanushreetumane@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-bisect.sh')
-rwxr-xr-x | git-bisect.sh | 60 |
1 files changed, 4 insertions, 56 deletions
diff --git a/git-bisect.sh b/git-bisect.sh index 9e993a8187..5ef3e25621 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -271,59 +271,14 @@ bisect_state() { bisect_auto_next } -bisect_next_check() { - missing_good= missing_bad= - git show-ref -q --verify refs/bisect/$TERM_BAD || missing_bad=t - test -n "$(git for-each-ref "refs/bisect/$TERM_GOOD-*")" || missing_good=t - - case "$missing_good,$missing_bad,$1" in - ,,*) - : have both $TERM_GOOD and $TERM_BAD - ok - ;; - *,) - # do not have both but not asked to fail - just report. - false - ;; - t,,"$TERM_GOOD") - # have bad (or new) but not good (or old). we could bisect although - # this is less optimum. - eval_gettextln "Warning: bisecting only with a \$TERM_BAD commit." >&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 "Are you sure [Y/n]? " >&2 - read yesno - case "$yesno" in [Nn]*) exit 1 ;; esac - fi - : bisect without $TERM_GOOD... - ;; - *) - bad_syn=$(bisect_voc bad) - good_syn=$(bisect_voc good) - if test -s "$GIT_DIR/BISECT_START" - then - - eval_gettextln "You need to give me at least one \$bad_syn and one \$good_syn revision. -(You can use \"git bisect \$bad_syn\" and \"git bisect \$good_syn\" for that.)" >&2 - else - eval_gettextln "You need to start by \"git bisect start\". -You then need to give me at least one \$good_syn and one \$bad_syn revision. -(You can use \"git bisect \$bad_syn\" and \"git bisect \$good_syn\" for that.)" >&2 - fi - exit 1 ;; - esac -} - bisect_auto_next() { - bisect_next_check && bisect_next || : + git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD && bisect_next || : } bisect_next() { case "$#" in 0) ;; *) usage ;; esac bisect_autostart - bisect_next_check $TERM_GOOD + 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 $(test -f "$GIT_DIR/BISECT_HEAD" && echo --no-checkout) @@ -355,7 +310,7 @@ bisect_next() { } bisect_visualize() { - bisect_next_check fail + git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD fail || exit if test $# = 0 then @@ -409,7 +364,7 @@ bisect_replay () { } bisect_run () { - bisect_next_check fail + git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD fail || exit test -n "$*" || die "$(gettext "bisect run failed: no command provided.")" @@ -484,13 +439,6 @@ get_terms () { fi } -bisect_voc () { - case "$1" in - bad) echo "bad|new" ;; - good) echo "good|old" ;; - esac -} - bisect_terms () { get_terms if ! test -s "$GIT_DIR/BISECT_TERMS" |