summaryrefslogtreecommitdiff
path: root/git-bisect.sh
diff options
context:
space:
mode:
authorPranit Bauva <pranit.bauva@gmail.com>2019-01-02 15:38:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-01-02 18:23:03 (GMT)
commit450ebb7359ec379a282670e85536540734c45eed (patch)
tree0f3b8ff0cde2ec364b9c73a4cc876aab051774e5 /git-bisect.sh
parent129a6cf344c4b352433f5a24de02a62783f6c6df (diff)
downloadgit-450ebb7359ec379a282670e85536540734c45eed.zip
git-450ebb7359ec379a282670e85536540734c45eed.tar.gz
git-450ebb7359ec379a282670e85536540734c45eed.tar.bz2
bisect--helper: `get_terms` & `bisect_terms` shell function in C
Reimplement the `get_terms` and `bisect_terms` shell function in C and add `bisect-terms` subcommand to `git bisect--helper` to call it from git-bisect.sh . Using `--bisect-terms` subcommand is a temporary measure to port shell function in 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. Also use error() to report "no terms defined" and accordingly change the test in t6030. We need to use PARSE_OPT_KEEP_UNKNOWN here to allow for parameters that look like options (e.g --term-good) but should not be parsed by cmd_bisect__helper(). This change is safe because all other cmdmodes have strict argc checks already. 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-xgit-bisect.sh35
1 files changed, 2 insertions, 33 deletions
diff --git a/git-bisect.sh b/git-bisect.sh
index 5ef3e25..bdb614e 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -355,7 +355,7 @@ bisect_replay () {
"$TERM_GOOD"|"$TERM_BAD"|skip)
git bisect--helper --bisect-write "$command" "$rev" "$TERM_GOOD" "$TERM_BAD" || exit;;
terms)
- bisect_terms $rev ;;
+ git bisect--helper --bisect-terms $rev || exit;;
*)
die "$(gettext "?? what are you talking about?")" ;;
esac
@@ -439,37 +439,6 @@ get_terms () {
fi
}
-bisect_terms () {
- get_terms
- if ! test -s "$GIT_DIR/BISECT_TERMS"
- then
- die "$(gettext "no terms defined")"
- fi
- case "$#" in
- 0)
- gettextln "Your current terms are $TERM_GOOD for the old state
-and $TERM_BAD for the new state."
- ;;
- 1)
- arg=$1
- case "$arg" in
- --term-good|--term-old)
- printf '%s\n' "$TERM_GOOD"
- ;;
- --term-bad|--term-new)
- printf '%s\n' "$TERM_BAD"
- ;;
- *)
- die "$(eval_gettext "invalid argument \$arg for 'git bisect terms'.
-Supported options are: --term-good|--term-old and --term-bad|--term-new.")"
- ;;
- esac
- ;;
- *)
- usage ;;
- esac
-}
-
case "$#" in
0)
usage ;;
@@ -500,7 +469,7 @@ case "$#" in
run)
bisect_run "$@" ;;
terms)
- bisect_terms "$@" ;;
+ git bisect--helper --bisect-terms "$@" || exit;;
*)
usage ;;
esac