summaryrefslogtreecommitdiff
path: root/git-bisect.sh
diff options
context:
space:
mode:
authorPranit Bauva <pranit.bauva@gmail.com>2017-09-29 06:49:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-10-06 05:12:30 (GMT)
commit4ba1e5c4144bd268dafb252fd652dd37d9e4a1ed (patch)
tree3bf59da921253447961a1027ae846177aa5f06c4 /git-bisect.sh
parent9e1c84dfd5311c80962ea0f8a1589881c20d028d (diff)
downloadgit-4ba1e5c4144bd268dafb252fd652dd37d9e4a1ed.zip
git-4ba1e5c4144bd268dafb252fd652dd37d9e4a1ed.tar.gz
git-4ba1e5c4144bd268dafb252fd652dd37d9e4a1ed.tar.bz2
bisect--helper: rewrite `check_term_format` shell function in C
Reimplement the `check_term_format` shell function in C and add a `--check-term-format` subcommand to `git bisect--helper` to call it from git-bisect.sh Using `--check-term-format` subcommand 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 and its implementation will be called by some other method/subcommand. For eg. In conversion of write_terms() of git-bisect.sh, the subcommand will be removed and instead check_term_format() will be called in its C implementation while a new subcommand will be introduced for write_terms(). Helped-by: Johannes Schindelein <Johannes.Schindelein@gmx.de> Mentored-by: Lars Schneider <larsxschneider@gmail.com> Mentored-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-bisect.sh')
-rwxr-xr-xgit-bisect.sh31
1 files changed, 2 insertions, 29 deletions
diff --git a/git-bisect.sh b/git-bisect.sh
index ae3cb01..a727c59 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -564,38 +564,11 @@ write_terms () {
then
die "$(gettext "please use two different terms")"
fi
- check_term_format "$TERM_BAD" bad
- check_term_format "$TERM_GOOD" good
+ git bisect--helper --check-term-format "$TERM_BAD" bad || exit
+ git bisect--helper --check-term-format "$TERM_GOOD" good || exit
printf '%s\n%s\n' "$TERM_BAD" "$TERM_GOOD" >"$GIT_DIR/BISECT_TERMS"
}
-check_term_format () {
- term=$1
- git check-ref-format refs/bisect/"$term" ||
- die "$(eval_gettext "'\$term' is not a valid term")"
- case "$term" in
- help|start|terms|skip|next|reset|visualize|replay|log|run)
- die "$(eval_gettext "can't use the builtin command '\$term' as a term")"
- ;;
- bad|new)
- if test "$2" != bad
- then
- # In theory, nothing prevents swapping
- # completely good and bad, but this situation
- # could be confusing and hasn't been tested
- # enough. Forbid it for now.
- die "$(eval_gettext "can't change the meaning of term '\$term'")"
- fi
- ;;
- good|old)
- if test "$2" != good
- then
- die "$(eval_gettext "can't change the meaning of term '\$term'")"
- fi
- ;;
- esac
-}
-
check_and_set_terms () {
cmd="$1"
case "$cmd" in