Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH] git-bisect: do not get confused by packed-ref
Date: Thu, 26 Jul 2007 23:50:06 -0700	[thread overview]
Message-ID: <7v1weu49y9.fsf@assigned-by-dhcp.cox.net> (raw)

If an unfortunate user runs a pack-ref while a git-bisect is
active, refs/bisect/* references will stay behind even after the
git-bisect finishes, because the clean-up code only paid
attention to loose refs.  This has a potential to confuse later
bisect runs greatly.

Ideally we should further fix parts that manually creates the
good references refs/bisect/good-*, and updates bad reference
refs/bisect/bad, but that is a cleanliness not correctness
issue.  For 1.5.3, this minimum fix should do.

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

diff --git a/git-bisect.sh b/git-bisect.sh
index 388887a..77dad51 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -265,8 +265,16 @@ bisect_reset() {
 }
 
 bisect_clean_state() {
+	git for-each-ref --format='%(objectname) %(refname)' refs/bisect |
+	while read sha1 ref
+	do
+		git update-ref -d "$ref" "$sha1"
+	done
+	if current=$(git rev-parse --verify refs/heads/bisect 2>/dev/null)
+	then
+		git update-ref -d refs/heads/bisect "$current"
+	fi
 	rm -fr "$GIT_DIR/refs/bisect"
-	rm -f "$GIT_DIR/refs/heads/bisect"
 	rm -f "$GIT_DIR/BISECT_LOG"
 	rm -f "$GIT_DIR/BISECT_NAMES"
 	rm -f "$GIT_DIR/BISECT_RUN"

                 reply	other threads:[~2007-07-27  6:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=7v1weu49y9.fsf@assigned-by-dhcp.cox.net \
    --to=gitster@pobox.com \
    --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