summaryrefslogtreecommitdiffstats
path: root/git-bisect.sh
diff options
context:
space:
mode:
authorPranit Bauva <pranit.bauva@gmail.com>2017-09-29 06:49:39 +0000
committerJunio C Hamano <gitster@pobox.com>2017-10-06 14:12:33 +0900
commitfb71a329964da0892cc11cc94b5b379b0803ed92 (patch)
treec7140d412c414f18ecef52d281ca3e61d98aa90c /git-bisect.sh
parentecb3f3733cbeaf514508f97429863d33a6ac0d57 (diff)
downloadgit-fb71a329964da0892cc11cc94b5b379b0803ed92.tar.gz
git-fb71a329964da0892cc11cc94b5b379b0803ed92.tar.xz
bisect--helper: `bisect_clean_state` shell function in C
Reimplement `bisect_clean_state` shell function in C and add a `bisect-clean-state` subcommand to `git bisect--helper` to call it from git-bisect.sh . Using `--bisect-clean-state` subcommand is a 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 bisect_reset() and bisect_start(). Also introduce a function `mark_for_removal` to store the refs which need to be removed while iterating through the refs. 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.sh26
1 files changed, 3 insertions, 23 deletions
diff --git a/git-bisect.sh b/git-bisect.sh
index a80fc44e5..045830c39 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -186,7 +186,7 @@ bisect_start() {
#
# Get rid of any old bisect state.
#
- bisect_clean_state || exit
+ git bisect--helper --bisect-clean-state || exit
#
# Change state.
@@ -195,7 +195,7 @@ bisect_start() {
# We have to trap this to be able to clean up using
# "bisect_clean_state".
#
- trap 'bisect_clean_state' 0
+ trap 'git bisect--helper --bisect-clean-state' 0
trap 'exit 255' 1 2 3 15
#
@@ -430,27 +430,7 @@ bisect_reset() {
die "$(eval_gettext "Could not check out original HEAD '\$branch'.
Try 'git bisect reset <commit>'.")"
fi
- bisect_clean_state
-}
-
-bisect_clean_state() {
- # There may be some refs packed during bisection.
- git for-each-ref --format='%(refname) %(objectname)' refs/bisect/\* |
- while read ref hash
- do
- git update-ref -d $ref $hash || exit
- done
- rm -f "$GIT_DIR/BISECT_EXPECTED_REV" &&
- rm -f "$GIT_DIR/BISECT_ANCESTORS_OK" &&
- rm -f "$GIT_DIR/BISECT_LOG" &&
- rm -f "$GIT_DIR/BISECT_NAMES" &&
- rm -f "$GIT_DIR/BISECT_RUN" &&
- rm -f "$GIT_DIR/BISECT_TERMS" &&
- # Cleanup head-name if it got left by an old version of git-bisect
- rm -f "$GIT_DIR/head-name" &&
- git update-ref -d --no-deref BISECT_HEAD &&
- # clean up BISECT_START last
- rm -f "$GIT_DIR/BISECT_START"
+ git bisect--helper --bisect-clean-state || exit
}
bisect_replay () {