From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carl Worth Subject: Re: [PATCH] Eliminate confusing "won't bisect on seeked tree" failure Date: Sat, 23 Feb 2008 17:14:17 -0800 Message-ID: <87k5kvnok6.wl%cworth@cworth.org> References: <1203571214.24456.6.camel@homer.simson.net> <87pruqfc59.wl%cworth@cworth.org> <7v63wgap10.fsf@gitster.siamese.dyndns.org> <87oda7o742.wl%cworth@cworth.org> <7vejb3z3c5.fsf@gitster.siamese.dyndns.org> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: Mike Galbraith , git To: Junio C Hamano X-From: git-owner@vger.kernel.org Sun Feb 24 02:15:34 2008 Return-path: Envelope-to: gcvg-git-2@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1JT5Sn-0004bK-QN for gcvg-git-2@gmane.org; Sun, 24 Feb 2008 02:15:34 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753082AbYBXBOd (ORCPT ); Sat, 23 Feb 2008 20:14:33 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753197AbYBXBOd (ORCPT ); Sat, 23 Feb 2008 20:14:33 -0500 Received: from olra.theworths.org ([82.165.184.25]:54701 "EHLO olra.theworths.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753045AbYBXBOc (ORCPT ); Sat, 23 Feb 2008 20:14:32 -0500 Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id C895045496A; Sat, 23 Feb 2008 17:14:29 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IalF7JzvuhlZ; Sat, 23 Feb 2008 17:14:28 -0800 (PST) Received: from raht.cworth.org (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 06642431FDF; Sat, 23 Feb 2008 17:14:27 -0800 (PST) In-Reply-To: <7vejb3z3c5.fsf@gitster.siamese.dyndns.org> User-Agent: Wanderlust/2.14.0 (Africa) Emacs/21.4 Mule/5.0 (SAKAKI) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: This error message is very confusing---it doesn't tell the user anything about how to fix the situation. And the actual fix for the situation ("git bisect reset") does a checkout of a potentially random branch, (compared to what the user wants to be on for the bisect she is starting). The simplest way to eliminate the confusion is to just make "git bisect start" do the cleanup itself. There's no significant loss of safety here since we already have a general safety in the form of the reflog. Note: We preserve the warning for any cogito users. We do this by switching from .git/head-name to .git/BISECT_START for the extra state, (which is a more descriptive name anyway). Signed-off-by: Carl Worth --- On Sat, 23 Feb 2008 14:59:38 -0800, Junio C Hamano wrote: > Neither the earlier one nor this one passes t6030. Thanks. Both versions were definitely broken, and two of the three failures were a good catch of the bug I had introduced. The third failure was simply that the test needed to be updated to track the change from head-name to BISECT_START. And a quick "git grep head-name" of the source suggests that no other stale uses of head-name remain, (the things left in git-bisect are intentional for cogito compatibility as described above, and the things in git-rebase all refer to $DOTEST/head-name which is distinct. Third time's the charm by chance? -Carl git-bisect.sh | 14 +++++++++----- t/t6030-bisect-porcelain.sh | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/git-bisect.sh b/git-bisect.sh index 74715ed..2c32d0b 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -67,16 +67,18 @@ bisect_start() { die "Bad HEAD - I need a HEAD" case "$head" in refs/heads/bisect) - if [ -s "$GIT_DIR/head-name" ]; then - branch=`cat "$GIT_DIR/head-name"` + if [ -s "$GIT_DIR/BISECT_START" ]; then + branch=`cat "$GIT_DIR/BISECT_START"` else branch=master fi git checkout $branch || exit ;; refs/heads/*|$_x40) + # This error message should only be triggered by cogito usage, + # and cogito users should understand it relates to cg-seek. [ -s "$GIT_DIR/head-name" ] && die "won't bisect on seeked tree" - echo "${head#refs/heads/}" >"$GIT_DIR/head-name" + echo "${head#refs/heads/}" >"$GIT_DIR/BISECT_START" ;; *) die "Bad HEAD - strange symbolic ref" @@ -353,8 +355,8 @@ bisect_reset() { return } case "$#" in - 0) if [ -s "$GIT_DIR/head-name" ]; then - branch=`cat "$GIT_DIR/head-name"` + 0) if [ -s "$GIT_DIR/BISECT_START" ]; then + branch=`cat "$GIT_DIR/BISECT_START"` else branch=master fi ;; @@ -365,7 +367,9 @@ bisect_reset() { usage ;; esac if git checkout "$branch"; then + # Cleanup head-name if it got left by an old version of git-bisect rm -f "$GIT_DIR/head-name" + rm -f "$GIT_DIR/BISECT_START" bisect_clean_state fi } diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index ec71123..4908e87 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -260,7 +260,7 @@ test_expect_success 'bisect starting with a detached HEAD' ' git checkout master^ && HEAD=$(git rev-parse --verify HEAD) && git bisect start && - test $HEAD = $(cat .git/head-name) && + test $HEAD = $(cat .git/BISECT_START) && git bisect reset && test $HEAD = $(git rev-parse --verify HEAD) -- 1.5.4.1