summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Matthieu Moy <Matthieu.Moy@imag.fr>2015-06-29 17:40:31 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-08-03 11:42:42 -0700
commit4a6ada32cb64b0eba8b6f995e4230f0c722fd580 (patch)
tree3a6644345afa001baec4e9f5c7c0efd0dedba938
parentbisect: simplify the addition of new bisect terms (diff)
downloadtgif-4a6ada32cb64b0eba8b6f995e4230f0c722fd580.tar.xz
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>
-rwxr-xr-xgit-bisect.sh30
1 files changed, 17 insertions, 13 deletions
diff --git a/git-bisect.sh b/git-bisect.sh
index dcd7e5900e..ea63223ab3 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,24 +103,27 @@ bisect_start() {
die "$(eval_gettext "'\$arg' does not appear to be a valid revision")"
break
}
-
- # The user ran "git bisect start <sha1>
- # <sha1>", 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 <sha1>
+ # <sha1>", 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.
#