From: Junio C Hamano Date: Tue, 02 Aug 2011 23:01:28 GMT Subject: Re: [PATCH v14 5/8] bisect: introduce --no-checkout support into porcelain. Message-ID: <7voc07ct9z.fsf@alter.siamese.dyndns.org> In-Reply-To: <1312323362-20096-6-git-send-email-jon.seymour@gmail.com> Jon Seymour writes: > + BISECT_MODE= > while [ $# -gt 0 ]; do > arg="$1" > case "$arg" in > @@ -76,6 +79,11 @@ bisect_start() { > shift > break > ;; > + --no-checkout) > + BISECT_MODE=--no-checkout; > + shift ;; > + --*) > + die "$(eval_gettext "unrecognised option: '\$arg'")" ;; > *) > rev=$(git rev-parse -q --verify "$arg^{commit}") || { > test $has_double_dash -eq 1 && > @@ -107,7 +115,11 @@ bisect_start() { > then > # Reset to the rev from where we started. > start_head=$(cat "$GIT_DIR/BISECT_START") > - git checkout "$start_head" -- || exit > + if test "$BISECT_MODE" = "--no-checkout"; then > + git update-ref --no-deref HEAD "$start_head" > + else > + git checkout "$start_head" -- > + fi Just a minor worry but I would not be surprised if somebody's "test" implementation barfs upon: test "--no-checkout" = "--no-checkout" mistaking the string with a dash at the beginning as an option unknown to it. That is why we often have "z$variable" in our comparison, like so: if test "z$BISECT_MODE" = "z--no-checkout" then git update-ref --no-deref BISECT_HEAD "$start_head" else git checkout "$start_head" -- fi > - git rev-parse --sq-quote "$@" >"$GIT_DIR/BISECT_NAMES" && > + git rev-parse --sq-quote "$@" >"$GIT_DIR/BISECT_NAMES" > + echo "$BISECT_MODE" > "$GIT_DIR/BISECT_MODE" && &&?