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

Re: [RFC/PATCH] Bisect: teach "bisect start" to optionally use one bad and many good revs.

From
Junio C Hamano <junkio@cox.net>
Date
Apr 3, 2007, 20:02 UTC
Message-ID
<7vzm5pw7ju.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20070401145723.27e17177.chriscool@tuxfamily.org>
Christian Couder <chriscool@tuxfamily.org> writes:
Show 11 quoted lines
> In fact this patch implements:
>
>     git bisect start [<bad> [<good>...]] [--] [<pathspec>...]
>
> I think this is more backward compatible because older script
> probably didn't used -- before <pathspec>...
>
> On the other hand, there may be some confusion between revs
> (<bad> and <good>...) and <pathspec>... if -- is not used
> and if an invalid rev or a pathspec that looks like a rev is
> given.

I think the intent of the check you have for '--' to cover the above issue is good.

Show 42 quoted lines
>
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> ---
>  git-bisect.sh         |  105 ++++++++++++++++++++++++++++++++++++++-----------
>  t/t6030-bisect-run.sh |   20 ++++++++-
>  2 files changed, 99 insertions(+), 26 deletions(-)
>
> diff --git a/git-bisect.sh b/git-bisect.sh
> index 11313a7..d5a13ee 100755
> --- a/git-bisect.sh
> +++ b/git-bisect.sh
> @@ -1,15 +1,24 @@
>  #!/bin/sh
>  
>  USAGE='[start|bad|good|next|reset|visualize|replay|log|run]'
> -LONG_USAGE='git bisect start [<pathspec>]	reset bisect state and start bisection.
> -git bisect bad [<rev>]		mark <rev> a known-bad revision.
> -git bisect good [<rev>...]	mark <rev>... known-good revisions.
> -git bisect next			find next bisection to test and check it out.
> -git bisect reset [<branch>]	finish bisection search and go back to branch.
> -git bisect visualize            show bisect status in gitk.
> -git bisect replay <logfile>	replay bisection log.
> -git bisect log			show bisect log.
> -git bisect run <cmd>... 	use <cmd>... to automatically bisect.'
> +LONG_USAGE='git bisect start [<bad> [<good>...]] [--] [<pathspec>...]
> +        reset bisect state and start bisection.
> +git bisect bad [<rev>]
> +        mark <rev> a known-bad revision.
> +git bisect good [<rev>...]
> +        mark <rev>... known-good revisions.
> +git bisect next
> +        find next bisection to test and check it out.
> +git bisect reset [<branch>]
> +        finish bisection search and go back to branch.
> +git bisect visualize
> +        show bisect status in gitk.
> +git bisect replay <logfile>
> +        replay bisection log.
> +git bisect log
> +        show bisect log.
> +git bisect run <cmd>...
> +        use <cmd>... to automatically bisect.'
Much easier to read ;-).
Show 9 quoted lines
>  	mkdir "$GIT_DIR/refs/bisect"
> +
> +	#
> +	# Check for one bad and then some good revisions.
> +	#
> +	has_double_dash=0
> +	for arg in "$@"; do
> +	    case "$arg" in --) has_double_dash=1; break ;; esac
> +	done
Style.  'in "$@"' is superfluous.
	for arg
        do
        	...
	done
> +	orig_args="$@"

Doesn't this defeat the whole point of later running 'sq' on it? The reason we do sq is to protect whitespaces in pathspecs and make the strings correctly split when evaled/sourced.

A simple test program:
        #!/bin/sh
        sq () {
                echo "** fake sq $* **"
                i=0
                for j
                do
                        echo "$i: <$j>"
                        i=$(( $i + 1 ))
                done
                echo
        }
        set x a 'b c' d
        shift
        # Now, $# = 3, $1 = 'a', $2 = 'b c' and $3 = 'd'
        orig_args="$@"
        sq "$@"
        sq "$orig_args"
Show 8 quoted lines
> ...
> -	    sq "$@"
> -	} >"$GIT_DIR/BISECT_LOG"
> -	sq "$@" >"$GIT_DIR/BISECT_NAMES"
> +	    sq "$orig_args"
> +	} >>"$GIT_DIR/BISECT_LOG"
> +	bisect_auto_next
>  }
Previous: Christian CouderNext: Christian Couder
Message 2 of 9 in “Bisect: teach "bisect start" to optionally use one bad and many good revs.”
  1. Bisect: teach "bisect start" to optionally use one bad and many good revs.Christian Couder, Apr 1, 2007
  2. Junio C HamanoApr 3, 2007
  3. Bisect: teach "bisect start" to optionally use one bad and many good revs.Christian Couder, Apr 4, 2007
  4. Documentation: bisect: "start" accepts one bad and many good commitsChristian Couder, Apr 5, 2007
  5. Junio C HamanoApr 5, 2007
  6. 2/2 git-bisect: allow bisecting with only one bad commit.Junio C Hamano, Apr 6, 2007
  7. Christian CouderApr 17, 2007
  8. Junio C HamanoApr 17, 2007
  9. 1/2 t6030: add a bit more tests to git-bisectJunio C Hamano, Apr 6, 2007

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.