From: Felipe Contreras <felipe.contreras@gmail.com>
To: Ed Avis <ed.avis@qmaw.com>, git@vger.kernel.org
Subject: RE: Feature request: 'git bisect run' option to redundantly check start and end commits
Date: Fri, 18 Dec 2020 09:35:01 -0600 [thread overview]
Message-ID: <5fdccc25255b7_1273af2086c@natae.notmuch> (raw)
In-Reply-To: <PH0PR11MB48875130A7DF30A7394DD3619DC30@PH0PR11MB4887.namprd11.prod.outlook.com>
Ed Avis wrote:
> When kicking off a 'git bisect run', I have manually chosen good and
> bad commits, but I would like to double check that the command given
> to run really does succeed for the good commit and fail for the bad
> one. Of course I can switch to those commits and run it manually, but
> mistakes can happen. It's frustrating to set up a bisection and then
> find at the end that the first bad commit is the one immediately after
> 'good', because the command string just failed every time. An
> optional startup check of the two endpoints would only be a small
> slowdown in most cases, but could save a lot of time.
I like this idea.
I for one have to think twice if I should do the extra check manually or
not, and the biggest reason why I usually don't is because it would not
be automated.
With an option like that I would have no excuse.
Here's a quick patch to implement such feature (it doesn't apply
directly, it's mostly for human eyes).
diff --git a/git-bisect.sh b/git-bisect.sh
index 1f3f6e9fc5..e8adeab008 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -109,13 +109,7 @@ bisect_replay () {
git bisect--helper --bisect-auto-next || exit
}
-bisect_run () {
- git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD fail || exit
-
- test -n "$*" || die "$(gettext "bisect run failed: no command provided.")"
-
- while true
- do
+run_command () {
command="$@"
eval_gettextln "running \$command"
"$@"
@@ -140,6 +134,41 @@ exit code \$res from '\$command' is < 0 or >= 128" >&2
else
state="$TERM_GOOD"
fi
+}
+
+run_check () {
+ rev=$1
+ term=$2
+ shift 2
+ git checkout $rev
+ run_command "$@"
+ echo "# recheck $term ($state): $(git show-branch $rev)" >>"$GIT_DIR/BISECT_LOG"
+ [[ "$state" != "$term" ]] &&
+ die "$(eval_gettext "check failed, expected \$rev to be \$term")"
+}
+
+bisect_run () {
+ git bisect--helper --bisect-next-check $TERM_GOOD $TERM_BAD fail || exit
+
+ if [ "$1" = "--recheck" ]
+ then
+ shift
+ test -n "$*" || die "$(gettext "bisect run failed: no command provided.")"
+
+ rev=$(git show-ref --hash --verify refs/bisect/$TERM_BAD)
+ run_check $rev "$TERM_BAD" "$@"
+
+ rev=$(git for-each-ref --format="%(objectname)" "refs/bisect/$TERM_GOOD-*")
+ run_check $rev "$TERM_GOOD" "$@"
+
+ git bisect--helper --bisect-next || exit
+ else
+ test -n "$*" || die "$(gettext "bisect run failed: no command provided.")"
+ fi
+
+ while true
+ do
+ run_command "$@"
git bisect--helper --bisect-state $state >"$GIT_DIR/BISECT_RUN"
res=$?
--
Felipe Contreras
next prev parent reply other threads:[~2020-12-18 15:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-18 12:22 Feature request: 'git bisect run' option to redundantly check start and end commits Ed Avis
2020-12-18 15:35 ` Felipe Contreras [this message]
2020-12-18 16:16 ` Christian Couder
2020-12-18 17:15 ` Felipe Contreras
2020-12-19 7:46 ` Christian Couder
2020-12-19 11:39 ` Felipe Contreras
2020-12-19 17:31 ` Junio C Hamano
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=5fdccc25255b7_1273af2086c@natae.notmuch \
--to=felipe.contreras@gmail.com \
--cc=ed.avis@qmaw.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;
as well as URLs for NNTP newsgroup(s).