git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Christian Couder <chriscool@tuxfamily.org>
Cc: git@vger.kernel.org
Subject: [PATCH 3/3] git-bisect: modernize branch shuffling hack
Date: Thu, 15 Nov 2007 01:01:52 -0800	[thread overview]
Message-ID: <7vfxz76fwf.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20071115081807.06fe092b.chriscool@tuxfamily.org> (Christian Couder's message of "Thu, 15 Nov 2007 08:18:07 +0100")

When switching to a new rev, we first made "new-bisect" branch to
point at the chosen commit, attempt to switch to it, and then
finally renamed the new-bisect branch to bisect by hand when
successful.  This is so that we can catch checkout failure (your
local modification may interfere with switching to the chosen
version) without losing information on which commit the next
attempt should be made.

Rewrite it using a more modern form but without breaking the
safety.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-bisect.sh |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/git-bisect.sh b/git-bisect.sh
index 4b74a7b..dae8a8e 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -316,10 +316,9 @@ bisect_next() {
 	exit_if_skipped_commits "$bisect_rev"
 
 	echo "Bisecting: $bisect_nr revisions left to test after this"
-	echo "$bisect_rev" >"$GIT_DIR/refs/heads/new-bisect"
+	git branch -f new-bisect "$bisect_rev"
 	git checkout -q new-bisect || exit
-	mv "$GIT_DIR/refs/heads/new-bisect" "$GIT_DIR/refs/heads/bisect" &&
-	GIT_DIR="$GIT_DIR" git symbolic-ref HEAD refs/heads/bisect
+	git branch -M new-bisect bisect
 	git show-branch "$bisect_rev"
 }
 
-- 
1.5.3.5.1780.gca2b

      parent reply	other threads:[~2007-11-15  9:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-15  7:18 [PATCH v2] Bisect reset: remove bisect refs that may have been packed Christian Couder
2007-11-15  8:18 ` Junio C Hamano
2007-11-15  8:27   ` Johannes Sixt
2007-11-15  8:49     ` Shawn O. Pearce
2007-11-15  8:52       ` Jeff King
2007-11-15 12:10         ` Johannes Schindelin
2007-11-15  8:34   ` Junio C Hamano
2007-11-15  9:00 ` [PATCH 1/3] git-bisect: war on "sed" Junio C Hamano
2007-11-15  9:29   ` Miles Bader
2007-11-15  9:36     ` Wincent Colaiuta
2007-11-15  9:53       ` Miles Bader
2007-11-15 10:06         ` Andreas Ericsson
2007-11-15 10:14           ` David Kastrup
     [not found]         ` <86tznn4y7v.fsf@lola.quinscape.zz>
2007-11-15 11:00           ` Miles Bader
2007-11-15 11:18             ` David Kastrup
2007-11-15 12:59               ` Miles Bader
2007-11-15  9:01 ` [PATCH 2/3] git-bisect: use update-ref to mark good/bad commits Junio C Hamano
2007-11-15  9:01 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vfxz76fwf.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).