bisect: don't mix option parsing and non-trivial code

As-is, the revisions that appear on the command-line are processed in
order. This would mix badly with code that changes the configuration
(e.g. change $TERM_GOOD and $TERM_BAD) while processing the options.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Matthieu Moy 2015-06-29 17:40:31 +02:00 committed by Junio C Hamano
parent cb46d630ba
commit 4a6ada32cb
1 changed files with 17 additions and 13 deletions

View File

@ -78,6 +78,7 @@ bisect_start() {
bad_seen=0 bad_seen=0
eval='' eval=''
must_write_terms=0 must_write_terms=0
revs=''
if test "z$(git rev-parse --is-bare-repository)" != zfalse if test "z$(git rev-parse --is-bare-repository)" != zfalse
then then
mode=--no-checkout mode=--no-checkout
@ -102,7 +103,14 @@ bisect_start() {
die "$(eval_gettext "'\$arg' does not appear to be a valid revision")" die "$(eval_gettext "'\$arg' does not appear to be a valid revision")"
break break
} }
revs="$revs $rev"
shift
;;
esac
done


for rev in $revs
do
# The user ran "git bisect start <sha1> # The user ran "git bisect start <sha1>
# <sha1>", hence did not explicitly specify # <sha1>", hence did not explicitly specify
# the terms, but we are already starting to # the terms, but we are already starting to
@ -115,11 +123,7 @@ bisect_start() {
*) state=$TERM_GOOD ;; *) state=$TERM_GOOD ;;
esac esac
eval="$eval bisect_write '$state' '$rev' 'nolog' &&" eval="$eval bisect_write '$state' '$rev' 'nolog' &&"
shift
;;
esac
done done

# #
# Verify HEAD. # Verify HEAD.
# #