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

Re: [PATCH 2/3] bisect: add tests for bisection on bare repositories

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Aug 7, 2011, 13:39 UTC
Message-ID
<20110807133939.GA10748@elie.gateway.2wire.net>
In-Reply-To
<1312714240-23647-3-git-send-email-jon.seymour@gmail.com>
Jon Seymour wrote:
> We add a test to check that bisection works on bare repositories
> both when --no-checkout is specified explicitly and when it
> is defaulted.
Yay!
Show 9 quoted lines
> --- a/t/t6030-bisect-porcelain.sh
> +++ b/t/t6030-bisect-porcelain.sh
> @@ -592,6 +592,34 @@ test_expect_success 'erroring out when using bad path parameters' '
>  	grep "bad path parameters" error.txt
>  '
>  
> +test_expect_success 'create bare repo' '
> +	git clone --bare . bare
> +'

I'd prefer to see separate clones for the two tests, so if one catastrophically fails it does not affect the other.

Show 12 quoted lines
> +
> +test_expect_success 'test bisection on bare repo - --no-checkout specified' '
> +	test_when_finished "cd .." &&
> +	cd bare &&
> +	git bisect start --no-checkout &&
> +	git bisect good $HASH1 &&
> +	git bisect bad $HASH4 &&
> +	git bisect run sh -c \
> +		"test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \
> +		>../my_bisect_log.txt &&
> +	grep "$HASH3 is the first bad commit" ../my_bisect_log.txt &&
> +	git bisect reset'

I worry that "sh" might not actually be a POSIX shell on some systems. Maybe a subshell could also simplify this. Like so:

	git clone --bare . bare.nocheckout &&
	(
		cd bare &&
		git bisect start --no-checkout &&
		git bisect good $HASH1 &&
		git bisect bad $HASH4 &&
		git bisect run \
			eval "test \$(... " \
			>../log.nocheckout &&
		git bisect reset
	) &&
	grep "$HASH3 is the first bad commit" log.nocheckout
> +test_expect_success 'test bisection on bare repo - --no-checkout defaulted' '

Perhaps these could share code by using a function defined at the top of the file.

With or without the changes described above, I like it.  Thanks.
Previous: Jon SeymourNext: Jon Seymour
Message 9 of 12 in “bisect: add support for bisecting bare repositories”
  1. 0/3 bisect: add support for bisecting bare repositoriesJon Seymour, Aug 7, 2011
  2. 1/3 bisect: relax requirement for a working tree.Jon Seymour, Aug 7, 2011
  3. test z$foo = zbar (and Re: [PATCH 1/3] bisect: relax requirement for a working tree.)Jonathan Nieder, Aug 7, 2011
  4. Jon SeymourAug 7, 2011
  5. Stefano LattariniAug 7, 2011
  6. Jonathan NiederAug 7, 2011
  7. Jon SeymourAug 7, 2011
  8. 2/3 bisect: add tests for bisection on bare repositoriesJon Seymour, Aug 7, 2011
  9. Jonathan NiederAug 7, 2011
  10. Jon SeymourAug 7, 2011
  11. 3/3 bisect: document that --no-checkout is the default for bare repositoriesJon Seymour, Aug 7, 2011
  12. Jonathan NiederAug 7, 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.