mark <rev> a known-bad revision.
git bisect good [<rev>...]
mark <rev>... known-good revisions.
-git bisect skip [<rev>...]
+git bisect skip [(<rev>|<range>)...]
mark <rev>... untestable revisions.
git bisect next
find next bisection to test and check it out.
done
}
+bisect_skip() {
+ all=''
+ for arg in "$@"
+ do
+ case "$arg" in
+ *..*)
+ revs=$(git rev-list "$arg") || die "Bad rev input: $arg" ;;
+ *)
+ revs=$(sq "$arg") ;;
+ esac
+ all="$all $revs"
+ done
+ eval bisect_state 'skip' $all
+}
+
bisect_state() {
bisect_autostart
state=$1
EOF
}
+#
+# "check_merge_bases" checks that merge bases are not "bad".
+#
+# - If one is "good", that's good, we have nothing to do.
+# - If one is "bad", it means the user assumed something wrong
+# and we must exit.
+# - If one is "skipped", we can't know but we should warn.
+# - If we don't know, we should check it out and ask the user to test.
+#
+# In the last case we will return 1, and otherwise 0.
+#
check_merge_bases() {
_bad="$1"
_good="$2"
handle_skipped_merge_base "$_mb" "$_bad" "$_good"
else
bisect_checkout "$_mb" "a merge base must be tested"
- checkout_done=1
- return
+ return 1
fi
done
+ return 0
}
+#
+# "check_good_are_ancestors_of_bad" checks that all "good" revs are
+# ancestor of the "bad" rev.
+#
+# If that's not the case, we need to check the merge bases.
+# If a merge base must be tested by the user we return 1 and
+# otherwise 0.
+#
check_good_are_ancestors_of_bad() {
test -f "$GIT_DIR/BISECT_ANCESTORS_OK" &&
return
_side=$(git rev-list $_good ^$_bad)
if test -n "$_side"; then
+ # Return if a checkout was done
check_merge_bases "$_bad" "$_good" "$_skip" || return
- test "$checkout_done" -eq "1" && return
fi
: > "$GIT_DIR/BISECT_ANCESTORS_OK"
+
+ return 0
}
bisect_next() {
good=$(git for-each-ref --format='^%(objectname)' \
"refs/bisect/good-*" | tr '\012' ' ') &&
skip=$(git for-each-ref --format='%(objectname)' \
- "refs/bisect/skip-*" | tr '\012' ' ') &&
+ "refs/bisect/skip-*" | tr '\012' ' ') || exit
# Maybe some merge bases must be tested first
- check_good_are_ancestors_of_bad "$bad" "$good" "$skip" || exit
- test "$checkout_done" -eq "1" && checkout_done='' && return
+ check_good_are_ancestors_of_bad "$bad" "$good" "$skip"
+ # Return now if a checkout has already been done
+ test "$?" -eq "1" && return
# Get bisection information
BISECT_OPT=''
git bisect -h ;;
start)
bisect_start "$@" ;;
- bad|good|skip)
+ bad|good)
bisect_state "$cmd" "$@" ;;
+ skip)
+ bisect_skip "$@" ;;
next)
# Not sure we want "next" at the UI level anymore.
bisect_next "$@" ;;