"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: sanity check GOT_TEST_ALGO
To:
Stefan Sperling <stsp@stsp.name>
Cc:
gameoftrees@openbsd.org
Date:
Wed, 07 Aug 2024 14:24:40 +0200

Download raw body.

Thread
On 2024/08/07 13:12:01 +0200, Stefan Sperling <stsp@stsp.name> wrote:
> The test suite currently accepts invalid values for GOT_TEST_ALGO
> and implcitly uses sha1. With this patch 'git init' will error
> out on invalid values, causing the tests to spew lots of errors,
> including the git init error about an invalid object format (more erros
> result from tests continuing even though test_init failed).
> 
> Perhaps not the most user-friendly way but effective when someone
> makes a mistake specifying the algorithm.
> 
> ok?

makes sense, ok op@

Thanks!

> diff /home/stsp/src/got
> commit - 11f34534de34dc3b24c47b54c86b1fd8aaf8699d
> path + /home/stsp/src/got
> blob - 41051e07321fad9c5140c71182b0ca7d9fef2410
> file + regress/cmdline/common.sh
> --- regress/cmdline/common.sh
> +++ regress/cmdline/common.sh
> @@ -36,13 +36,8 @@ export MALLOC_OPTIONS=S
>  
>  git_init()
>  {
> -	args=
> -	if [ "${GOT_TEST_ALGO}" = sha256 ]; then
> -		args="--object-format=sha256"
> -	fi
> +	git init -q --object-format=${GOT_TEST_ALGO} "$1"
>  
> -	git init -q $args "$1"
> -
>  	# Switch the default branch to match our test expectations if needed.
>  	# Only need to change HEAD since 'git init' did not create any refs.
>  	# Relying on implementation details of 'git init' is no problem for us.