@matheusbsbs / matheus-bagliano / commits / ee2314f59a
Fork 0

bisect: teach "skip" to accept special arguments like "A..B"

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>

Christian Couder committed Nov 23, 2008 at 22:02 UTC ee2314f59a4eb8451008d4468fd96bb4e40763dc
1 file changed +18 -1
git-bisect.sh
+18 -1
@@ -191,6 +191,21 @@ check_expected_revs() {
191 done
192 }
193
194 +bisect_skip() {
195 + all=''
196 + for arg in "$@"
197 + do
198 + case "$arg" in
199 + *..*)
200 + revs=$(git rev-list "$arg") || die "Bad rev input: $arg" ;;
201 + *)
202 + revs="'$arg'" ;;
203 + esac
204 + all="$all $revs"
205 + done
206 + bisect_state 'skip' $all
207 +}
208 +
209 bisect_state() {
210 bisect_autostart
211 state=$1
@@ -630,8 +645,10 @@ case "$#" in
645 git bisect -h ;;
646 start)
647 bisect_start "$@" ;;
633 - bad|good|skip)
648 + bad|good)
649 bisect_state "$cmd" "$@" ;;
650 + skip)
651 + bisect_skip "$@" ;;
652 next)
653 # Not sure we want "next" at the UI level anymore.
654 bisect_next "$@" ;;