git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v14 5/8] bisect: introduce --no-checkout support into porcelain.

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 2, 2011, 23:01 UTC
Message-ID
<7voc07ct9z.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1312323362-20096-6-git-send-email-jon.seymour@gmail.com>
Jon Seymour <jon.seymour@gmail.com> writes:
Show 26 quoted lines
> +	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" &&
&&?
Previous: Jon SeymourNext: Junio C Hamano
Message 7 of 20 in “bisect: Add support for --no-checkout option”
  1. 0/8 bisect: Add support for --no-checkout optionJon Seymour, Aug 2, 2011
  2. 1/8 bisect: move argument parsing before state modification.Jon Seymour, Aug 2, 2011
  3. 2/8 bisect: use && to connect statements that are deferred with eval.Jon Seymour, Aug 2, 2011
  4. 3/8 bisect: add tests to document expected behaviour in presence of broken trees.Jon Seymour, Aug 2, 2011
  5. 4/8 bisect: introduce support for --no-checkout option.Jon Seymour, Aug 2, 2011
  6. 5/8 bisect: introduce --no-checkout support into porcelain.Jon Seymour, Aug 2, 2011
  7. Junio C HamanoAug 2, 2011
  8. Junio C HamanoAug 2, 2011
  9. Christian CouderAug 3, 2011
  10. Jon SeymourAug 3, 2011
  11. Jon SeymourAug 3, 2011
  12. Junio C HamanoAug 3, 2011
  13. Jonathan NiederAug 3, 2011
  14. Jon SeymourAug 3, 2011
  15. Jonathan NiederAug 3, 2011
  16. Christian CouderAug 3, 2011
  17. 6/8 bisect: add tests for the --no-checkout option.Jon Seymour, Aug 2, 2011
  18. 7/8 bisect: add documentation for --no-checkout option.Jon Seymour, Aug 2, 2011
  19. 8/8 bisect: change bisect function to update BISECT_HEAD, rather than HEAD.Jon Seymour, Aug 2, 2011
  20. Christian CouderAug 3, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.