Code

git-bisect: use update-ref to mark good/bad commits
[git.git] / git-bisect.sh
index 46a7b8d54a5ccec26c322c19ec821d71af317cf4..4b74a7bb421e35627bf749316027707237210e7a 100755 (executable)
@@ -71,7 +71,7 @@ bisect_start() {
                ;;
        refs/heads/*)
                [ -s "$GIT_DIR/head-name" ] && die "won't bisect on seeked tree"
-               echo "$head" | sed 's#^refs/heads/##' >"$GIT_DIR/head-name"
+               echo "${head#refs/heads/}" >"$GIT_DIR/head-name"
                ;;
        *)
                die "Bad HEAD - strange symbolic ref"
@@ -130,7 +130,7 @@ bisect_write() {
                good|skip)      tag="$state"-"$rev" ;;
                *)              die "Bad bisect_write argument: $state" ;;
        esac
-       echo "$rev" >"$GIT_DIR/refs/bisect/$tag"
+       git update-ref "refs/bisect/$tag" "$rev"
        echo "# $state: "$(git show-branch $rev) >>"$GIT_DIR/BISECT_LOG"
        test -z "$nolog" && echo "git-bisect $state $rev" >>"$GIT_DIR/BISECT_LOG"
 }
@@ -275,8 +275,7 @@ 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/[|]/\
-/g'
+               echo "$_tried" | tr '[|]' '[\012]'
                echo "We cannot bisect more!"
                exit 2
        fi