git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Seymour <jon.seymour@gmail.com>
To: git@vger.kernel.org
Cc: chriscool@tuxfamily.org, gitster@pobox.com, j6t@kdbg.org,
	jnareb@gmail.com, Jon Seymour <jon.seymour@gmail.com>
Subject: [PATCH v8a] bisect: fix 'git bisect run' so that it works with alternate --update-ref
Date: Sun, 31 Jul 2011 23:46:43 +1000	[thread overview]
Message-ID: <1312120003-26321-1-git-send-email-jon.seymour@gmail.com> (raw)

An additional patch for the v8 series that ensures that 'git bisect run'
respects .git/BISECT_UPDATE_REF.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
---
 git-bisect.sh               |    5 +++--
 t/t6030-bisect-porcelain.sh |   15 +++++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/git-bisect.sh b/git-bisect.sh
index ec70cd2..126d698 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -230,8 +230,9 @@ bisect_state() {
 	0,*)
 		die "$(gettext "Please call 'bisect_state' with at least one argument.")" ;;
 	1,bad|1,good|1,skip)
-		rev=$(git rev-parse --verify HEAD) ||
-			die "$(gettext "Bad rev input: HEAD")"
+		ref=${BISECT_UPDATE_REF:-HEAD}
+		rev=$(git rev-parse --verify "$ref") ||
+			die "$(gettext "Bad rev input: $ref")"
 		bisect_write "$state" "$rev"
 		check_expected_revs "$rev" ;;
 	2,bad|*,good|*,skip)
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index fa4366f..40f7a76 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -736,4 +736,19 @@ test \$rc -eq 0;' &&
 	git bisect reset
 "
 
+test_expect_success 'bisect: demonstrate identification of damage boundary using alternate reference' "
+	git bisect reset &&
+	git checkout broken &&
+	git bisect start broken master --no-checkout --update-ref=CURSOR &&
+	git bisect run eval '
+rc=1;
+if git rev-list --objects CURSOR >tmp.$$; then
+   git pack-objects --stdout >/dev/null < tmp.$$ && rc=0;
+fi;
+rm tmp.$$;
+test \$rc -eq 0;' &&
+	check_same BROKEN_HASH6 bisect/bad &&
+	git bisect reset
+"
+
 test_done
-- 
1.7.6.389.gccb79d.dirty

                 reply	other threads:[~2011-07-31 13:47 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=1312120003-26321-1-git-send-email-jon.seymour@gmail.com \
    --to=jon.seymour@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=jnareb@gmail.com \
    /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).