Bisect reset: remove bisect refs that may have been packed.
[gitweb.git] / git-bisect.sh
index b74f44df603fa38dd2954aebe7a56a8480450236..46a7b8d54a5ccec26c322c19ec821d71af317cf4 100755 (executable)
@@ -275,7 +275,8 @@ exit_if_skipped_commits () {
        if expr "$_tried" : ".*[|].*" > /dev/null ; then
                echo "There are only 'skip'ped commit left to test."
                echo "The first bad commit could be any of:"
-               echo "$_tried" | sed -e 's/[|]/\n/g'
+               echo "$_tried" | sed -e 's/[|]/\
+/g'
                echo "We cannot bisect more!"
                exit 2
        fi
@@ -350,7 +351,13 @@ bisect_reset() {
 
 bisect_clean_state() {
        rm -fr "$GIT_DIR/refs/bisect"
-       rm -f "$GIT_DIR/refs/heads/bisect"
+
+       # There may be some refs packed during bisection.
+       git for-each-ref --format='%(refname) %(objectname)' refs/bisect/\* refs/heads/bisect |
+       while read ref hash
+       do
+               git update-ref -d $ref $hash
+       done
        rm -f "$GIT_DIR/BISECT_LOG"
        rm -f "$GIT_DIR/BISECT_NAMES"
        rm -f "$GIT_DIR/BISECT_RUN"