{"thread":{"id":"12007","subject":"git bisect start on a tag revision fails","startedAt":"2008-02-10T11:01:33Z","lastAt":"2008-02-10T13:59:50Z","messageCount":2,"participants":["Reece Dunn","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"68193","messageId":"3f4fd2640802100301y436bda41kcca1b1eb8ec0ea10@mail.gmail.com","threadId":"12007","inReplyTo":null,"subject":"git bisect start on a tag revision fails","fromName":"Reece Dunn","fromEmail":"msclrhd@googlemail.com","sentAt":"2008-02-10T11:01:33Z","receivedAt":"2008-02-10T11:01:33Z","isPatch":false,"sender":{"key":"msclrhd@googlemail.com","avatar":null},"body":"Hi,\n\nWhen hunting bugs with the wine source code\n(git://source.winehq.org/git/wine.git), both Dan Kegel and I have\nfound the following berhaviour with git bisect:\n\n$ git checkout wine-0.9.54\nHEAD is now at 8f954cc... Release 0.9.54.\n$ git bisect start\nfatal: ref HEAD is not a symbolic ref\nBad HEAD - I need a symbolic ref\n\nWhereas doing:\n\n$ git checkout master\n$ git bisect start\n\nthen:\n\n$ git checkout wine-0.9.54\n$ git bisect good\n\nworks.\n\nIs it possible to have bisect support non-symbolic refs?\n\n- Reece\n"},{"id":"68213","messageId":"alpine.LSU.1.00.0802101358440.11591@racer.site","threadId":"12007","inReplyTo":"3f4fd2640802100301y436bda41kcca1b1eb8ec0ea10@mail.gmail.com","subject":"[PATCH] bisect: allow starting with a detached HEAD","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-02-10T13:59:50Z","receivedAt":"2008-02-10T13:59:50Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nInstead of insisting on a symbolic ref, bisect now accepts detached\nHEADs, too.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tOn Sun, 10 Feb 2008, Reece Dunn wrote:\n\n\t> When hunting bugs with the wine source code\n\t> (git://source.winehq.org/git/wine.git), both Dan Kegel and I have\n\t> found the following berhaviour with git bisect:\n\t> \n\t> $ git checkout wine-0.9.54\n\t> HEAD is now at 8f954cc... Release 0.9.54.\n\t> $ git bisect start\n\t> fatal: ref HEAD is not a symbolic ref\n\t> Bad HEAD - I need a symbolic ref\n\n\tWoohoo!  test_expect_failure is nice... it tells you about\n\ta fixed behaviour, too!\n\n\t(Of course, I changed it to test_expect_success now...)\n\n git-bisect.sh               |    8 ++++++--\n t/t6030-bisect-porcelain.sh |   12 ++++++++++++\n 2 files changed, 18 insertions(+), 2 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 5385249..393fa35 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -26,6 +26,9 @@ OPTIONS_SPEC=\n . git-sh-setup\n require_work_tree\n \n+_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'\n+_x40=\"$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40\"\n+\n sq() {\n \t@@PERL@@ -e '\n \t\tfor (@ARGV) {\n@@ -60,7 +63,8 @@ bisect_start() {\n \t# top-of-line master first!\n \t#\n \thead=$(GIT_DIR=\"$GIT_DIR\" git symbolic-ref HEAD) ||\n-\tdie \"Bad HEAD - I need a symbolic ref\"\n+\thead=$(GIT_DIR=\"$GIT_DIR\" git rev-parse --verify HEAD) ||\n+\tdie \"Bad HEAD - I need a HEAD\"\n \tcase \"$head\" in\n \trefs/heads/bisect)\n \t\tif [ -s \"$GIT_DIR/head-name\" ]; then\n@@ -70,7 +74,7 @@ bisect_start() {\n \t\tfi\n \t\tgit checkout $branch || exit\n \t\t;;\n-\trefs/heads/*)\n+\trefs/heads/*|$_x40)\n \t\t[ -s \"$GIT_DIR/head-name\" ] && die \"won't bisect on seeked tree\"\n \t\techo \"${head#refs/heads/}\" >\"$GIT_DIR/head-name\"\n \t\t;;\ndiff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh\nindex 2ba4b00..ec71123 100755\n--- a/t/t6030-bisect-porcelain.sh\n+++ b/t/t6030-bisect-porcelain.sh\n@@ -254,6 +254,18 @@ test_expect_success 'bisect run & skip: find first bad' '\n \tgrep \"$HASH6 is first bad commit\" my_bisect_log.txt\n '\n \n+test_expect_success 'bisect starting with a detached HEAD' '\n+\n+\tgit bisect reset &&\n+\tgit checkout master^ &&\n+\tHEAD=$(git rev-parse --verify HEAD) &&\n+\tgit bisect start &&\n+\ttest $HEAD = $(cat .git/head-name) &&\n+\tgit bisect reset &&\n+\ttest $HEAD = $(git rev-parse --verify HEAD)\n+\n+'\n+\n #\n #\n test_done\n-- \n1.5.4.1264.gb53928\n"}]}