All of lore.kernel.org
 help / color / mirror / Atom feed
From: Torstein Hegge <hegge@resisty.net>
To: Christian Couder <chriscool@tuxfamily.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] bisect: Store first bad commit as comment in log file
Date: Mon, 22 Apr 2013 23:02:29 +0200	[thread overview]
Message-ID: <20130422210229.GE5650@pvv.ntnu.no> (raw)
In-Reply-To: <20130415095339.GA28480@pvv.ntnu.no>

On Mon, Apr 15, 2013 at 11:53:39 +0200, Torstein Hegge wrote:
> On Mon, Apr 15, 2013 at 06:38:09 +0200, Christian Couder wrote:
> > I wonder if we should also write something into the bisect log if for
> > example the bisection stopped because there are only 'skip'ped commits
> > left to test. But maybe this could go into another patch after this
> > one.
> 
> Yes, that would be useful, but I wasn't able to determine all the cases
> that would be relevant to log. Only skipped commits left to test is one,
> but bisect--helper also exits on various problems related to merge base
> handling. The handling of problems related to inconsistent user input is
> probably not relevant to log.

I took another look at this. I wasn't able to come up with anything
useful for the "The merge base $rev is bad" case, but for the "only
skipped commits left to test" case one could do something like this.

There has to be a better way to get the range of possible first bad
commits, similar to the output of 'git log --bisect --format="%H"'.

--- >8 ---
Subject: [PATCH] bisect: Log possibly bad, skipped commits at bisection end

If the bisection completes with only skipped commits left to as possible
first bad commit, output the list of possible first bad commits to human
readers of the bisection log.

Signed-off-by: Torstein Hegge <hegge@resisty.net>
---
 git-bisect.sh               |   10 ++++++++++
 t/t6030-bisect-porcelain.sh |   20 ++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/git-bisect.sh b/git-bisect.sh
index c58eea7..d7518e9 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -317,6 +317,16 @@ bisect_next() {
 		bad_commit=$(git show-branch $bad_rev)
 		echo "# first bad commit: $bad_commit" >>"$GIT_DIR/BISECT_LOG"
 		exit 0
+	elif test $res -eq 2
+	then
+		echo "# only skipped commits left to test" >>"$GIT_DIR/BISECT_LOG"
+		good_revs=$(git for-each-ref --format="--not %(objectname)" "refs/bisect/good-*")
+		for skipped in $(git rev-list refs/bisect/bad $good_revs)
+		do
+			skipped_commit=$(git show-branch $skipped)
+			echo "# possible first bad commit: $skipped_commit" >>"$GIT_DIR/BISECT_LOG"
+		done
+		exit $res
 	fi
 
 	# Check for an error in the bisection process
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index 4d3074a..064f5ce 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -759,4 +759,24 @@ test_expect_success 'bisect log: successfull result' '
 	git bisect reset
 '
 
+cat > expected.bisect-skip-log <<EOF
+# bad: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into <hello>.
+# good: [7b7f204a749c3125d5224ed61ea2ae1187ad046f] Add <2: A new day for git> into <hello>.
+git bisect start '32a594a3fdac2d57cf6d02987e30eec68511498c' '7b7f204a749c3125d5224ed61ea2ae1187ad046f'
+# skip: [3de952f2416b6084f557ec417709eac740c6818c] Add <3: Another new day for git> into <hello>.
+git bisect skip 3de952f2416b6084f557ec417709eac740c6818c
+# only skipped commits left to test
+# possible first bad commit: [32a594a3fdac2d57cf6d02987e30eec68511498c] Add <4: Ciao for now> into <hello>.
+# possible first bad commit: [3de952f2416b6084f557ec417709eac740c6818c] Add <3: Another new day for git> into <hello>.
+EOF
+
+test_expect_success 'bisect log: only skip commits left' '
+	git bisect reset &&
+	git bisect start $HASH4 $HASH2 &&
+	test_must_fail git bisect skip &&
+	git bisect log >bisect-skip-log.txt &&
+	test_cmp expected.bisect-skip-log bisect-skip-log.txt &&
+	git bisect reset
+'
+
 test_done
-- 
1.7.10.4

  parent reply	other threads:[~2013-04-22 21:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-13 15:22 [PATCH] bisect: Store first bad commit as comment in log file Torstein Hegge
2013-04-15  4:38 ` Christian Couder
2013-04-15  9:53   ` Torstein Hegge
2013-04-15 15:00     ` Junio C Hamano
2013-04-22 21:02     ` Torstein Hegge [this message]
2013-04-22 21:13       ` Junio C Hamano
2013-04-22 22:20         ` Torstein Hegge
2013-04-22 22:37           ` Junio C Hamano
2013-04-25  4:26           ` Christian Couder
2013-05-22 22:27       ` [PATCH] bisect: Fix log output for multi-parent skip ranges Torstein Hegge
2013-04-15  6:50 ` [PATCH] bisect: Store first bad commit as comment in log file 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=20130422210229.GE5650@pvv.ntnu.no \
    --to=hegge@resisty.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.