From: Matthieu Moy Date: Mon, 29 Jun 2015 15:40:31 GMT Subject: [PATCH v11 06/10] bisect: don't mix option parsing and non-trivial code Message-ID: <1435592435-27914-7-git-send-email-Matthieu.Moy@imag.fr> In-Reply-To: <1435592435-27914-1-git-send-email-Matthieu.Moy@imag.fr> 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 --- git-bisect.sh | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/git-bisect.sh b/git-bisect.sh index dcd7e59..f32fd2d 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -78,6 +78,7 @@ bisect_start() { bad_seen=0 eval='' must_write_terms=0 + revs='' if test "z$(git rev-parse --is-bare-repository)" != zfalse then mode=--no-checkout @@ -102,25 +103,27 @@ bisect_start() { die "$(eval_gettext "'\$arg' does not appear to be a valid revision")" break } - - # The user ran "git bisect start - # ", hence did not explicitly specify - # the terms, but we are already starting to - # set references named with the default terms, - # and won't be able to change afterwards. - must_write_terms=1 - - case $bad_seen in - 0) state=$TERM_BAD ; bad_seen=1 ;; - *) state=$TERM_GOOD ;; - esac - eval="$eval bisect_write '$state' '$rev' 'nolog' &&" + revs="$revs $rev" shift ;; esac done + for rev in $revs + do + # The user ran "git bisect start + # ", hence did not explicitly specify + # the terms, but we are already starting to + # set references named with the default terms, + # and won't be able to change afterwards. + must_write_terms=1 + + case $bad_seen in + 0) state=$TERM_BAD ; bad_seen=1 ;; + *) state=$TERM_GOOD ;; + esac + eval="$eval bisect_write '$state' '$rev' 'nolog' &&" + done # # Verify HEAD. # -- 2.5.0.rc0.10.gd2bff5d