Skip to content

Commit

Permalink
bisect: teach "skip" to accept special arguments like "A..B"
Browse files Browse the repository at this point in the history
The current "git bisect skip" syntax is "git bisect skip [<rev>...]"
so it's already possible to skip a range of revisions using
something like:

$ git bisect skip $(git rev-list A..B)

where A and B are the bounds of the range we want to skip.

This patch teaches "git bisect skip" to accept:

$ git bisect skip A..B

as an abbreviation for the former command.

This is done by checking each argument to see if it contains two
dots one after the other ('..'), and by expending it using
"git rev-list" if that is the case.

Note that this patch will not make "git bisect skip" accept all
that "git rev-list" accepts, as things like "^A B" for exemple
will not work. But things like "A B..C D E F.. ..G H...I" should
work as expected.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Christian Couder authored and Junio C Hamano committed Nov 26, 2008
1 parent ef3b38b commit ee2314f
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion git-bisect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,21 @@ check_expected_revs() {
done
}

bisect_skip() {
all=''
for arg in "$@"
do
case "$arg" in
*..*)
revs=$(git rev-list "$arg") || die "Bad rev input: $arg" ;;
*)
revs="'$arg'" ;;
esac
all="$all $revs"
done
bisect_state 'skip' $all
}

bisect_state() {
bisect_autostart
state=$1
Expand Down Expand Up @@ -630,8 +645,10 @@ case "$#" in
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 "$@" ;;
Expand Down

0 comments on commit ee2314f

Please sign in to comment.