aboutsummaryrefslogtreecommitdiffstats
path: root/git-bisect-script
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2005-08-30 11:04:39 -0700
committerJunio C Hamano <junkio@cox.net>2005-08-30 11:57:28 -0700
commit670f5fe34f0f6a363297d5dcd73051089b78fe82 (patch)
tree615d6a98d870d8822ce6cb5e2b61a18cf50ecb2e /git-bisect-script
parent61f01a5b773915402da37a34e706db56fe90b776 (diff)
downloadgit-670f5fe34f0f6a363297d5dcd73051089b78fe82.tar.gz
[PATCH] Fix bisection terminating condition
When testing bisection and using gitk to visualize the result, it was obvious that the termination condition was broken. We know what the bad entry is only when the bisection ends up telling us to test the known-bad entry again. Also, add a safety net: if somebody marks as good something that includes the known-bad point, we now notice and complain, instead of writing an empty revision to the new bisection branch. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-bisect-script')
-rwxr-xr-xgit-bisect-script8
1 files changed, 6 insertions, 2 deletions
diff --git a/git-bisect-script b/git-bisect-script
index 0c5c10750e..649b7026eb 100755
--- a/git-bisect-script
+++ b/git-bisect-script
@@ -105,12 +105,16 @@ bisect_next() {
good=$(git-rev-parse --sq --revs-only --not \
$(cd "$GIT_DIR" && ls refs/bisect/good-*)) &&
rev=$(eval "git-rev-list --bisect $good $bad") || exit
- nr=$(eval "git-rev-list $rev $good" | wc -l) || exit
- if [ "$nr" -le "1" ]; then
+ if [ -z "$rev" ]; then
+ echo "$bad was both good and bad"
+ exit 1
+ fi
+ if [ "$rev" = "$bad" ]; then
echo "$rev is first bad commit"
git-diff-tree --pretty $rev
exit 0
fi
+ nr=$(eval "git-rev-list $rev $good" | wc -l) || exit
echo "Bisecting: $nr revisions left to test after this"
echo "$rev" > "$GIT_DIR/refs/heads/new-bisect"
git checkout new-bisect || exit