X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-bisect.sh;h=03df1433ef12014584f23f16e65124c219c2f466;hb=fd7e9fb7ae206a64b87c7faecfc88716e98a7577;hp=07502536ce24edbcec8d516054f1756fd3abe9a1;hpb=4631c0035dc26ffab3a3832a5d9e9f55245f00f7;p=git.git diff --git a/git-bisect.sh b/git-bisect.sh index 07502536..03df1433 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -49,9 +49,16 @@ bisect_start() { die "Bad HEAD - I need a symbolic ref" case "$head" in refs/heads/bisect*) - git checkout master || exit + if [ -s "$GIT_DIR/head-name" ]; then + branch=`cat "$GIT_DIR/head-name"` + else + branch=master + fi + git checkout $branch || exit ;; refs/heads/*) + [ -s "$GIT_DIR/head-name" ] && die "won't bisect on seeked tree" + echo "$head" | sed 's#^refs/heads/##' >"$GIT_DIR/head-name" ;; *) die "Bad HEAD - strange symbolic ref" @@ -159,7 +166,11 @@ bisect_visualize() { bisect_reset() { case "$#" in - 0) branch=master ;; + 0) if [ -s "$GIT_DIR/head-name" ]; then + branch=`cat "$GIT_DIR/head-name"` + else + branch=master + fi ;; 1) test -f "$GIT_DIR/refs/heads/$1" || { echo >&2 "$1 does not seem to be a valid branch" exit 1 @@ -170,7 +181,7 @@ bisect_reset() { esac git checkout "$branch" && rm -fr "$GIT_DIR/refs/bisect" - rm -f "$GIT_DIR/refs/heads/bisect" + rm -f "$GIT_DIR/refs/heads/bisect" "$GIT_DIR/head-name" rm -f "$GIT_DIR/BISECT_LOG" rm -f "$GIT_DIR/BISECT_NAMES" }