summaryrefslogtreecommitdiff
path: root/git-bisect.sh
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2008-02-10 13:59:50 +0000
committerJunio C Hamano <gitster@pobox.com>2008-02-11 12:04:17 -0800
commitce32660edc2b83c6fdf550f6869e0b01e255dadb (patch)
tree05dd6d0b6d5f8c18e3aece6b239f47b18a8115e6 /git-bisect.sh
parent473d33168be9b0984f6281d5613f3b7b84817e99 (diff)
downloadgit-ce32660edc2b83c6fdf550f6869e0b01e255dadb.tar.gz
bisect: allow starting with a detached HEAD
Instead of insisting on a symbolic ref, bisect now accepts detached HEADs, too. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-bisect.sh')
-rwxr-xr-xgit-bisect.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/git-bisect.sh b/git-bisect.sh
index 5385249890..393fa35584 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -26,6 +26,9 @@ OPTIONS_SPEC=
. git-sh-setup
require_work_tree
+_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
+_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
+
sq() {
@@PERL@@ -e '
for (@ARGV) {
@@ -60,7 +63,8 @@ bisect_start() {
# top-of-line master first!
#
head=$(GIT_DIR="$GIT_DIR" git symbolic-ref HEAD) ||
- die "Bad HEAD - I need a symbolic ref"
+ head=$(GIT_DIR="$GIT_DIR" git rev-parse --verify HEAD) ||
+ die "Bad HEAD - I need a HEAD"
case "$head" in
refs/heads/bisect)
if [ -s "$GIT_DIR/head-name" ]; then
@@ -70,7 +74,7 @@ bisect_start() {
fi
git checkout $branch || exit
;;
- refs/heads/*)
+ refs/heads/*|$_x40)
[ -s "$GIT_DIR/head-name" ] && die "won't bisect on seeked tree"
echo "${head#refs/heads/}" >"$GIT_DIR/head-name"
;;