Subject: Re: [PATCH 04/18] t1401-symbolic-ref: avoid direct filesystem access

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Wed, 21 Apr 2021 08:09:28 +0200

On Mon, Apr 19 2021, Han-Wen Nienhuys via GitGitGadget wrote:

> From: Han-Wen Nienhuys <[email-masked]>
>
> Signed-off-by: Han-Wen Nienhuys <[email-masked]>
> ---
>  t/t1401-symbolic-ref.sh | 23 +++++++++--------------
>  1 file changed, 9 insertions(+), 14 deletions(-)
>
> diff --git a/t/t1401-symbolic-ref.sh b/t/t1401-symbolic-ref.sh
> index a4ebb0b65fec..fd5980d3fb40 100755
> --- a/t/t1401-symbolic-ref.sh
> +++ b/t/t1401-symbolic-ref.sh
> @@ -7,18 +7,13 @@ test_description='basic symbolic-ref tests'
>  # the git repo, meaning that further tests will operate on
>  # the surrounding git repo instead of the trash directory.
>  reset_to_sane() {
> -	echo ref: refs/heads/foo >.git/HEAD
> +	git --git-dir .git symbolic-ref HEAD refs/heads/foo

Isn't that "--git-dir .git" entirely redundant?

>  }
>  
> -test_expect_success 'symbolic-ref writes HEAD' '
> -	git symbolic-ref HEAD refs/heads/foo &&
> -	echo ref: refs/heads/foo >expect &&
> -	test_cmp expect .git/HEAD
> -'
> -
> -test_expect_success 'symbolic-ref reads HEAD' '
> -	echo refs/heads/foo >expect &&
> -	git symbolic-ref HEAD >actual &&
> +test_expect_success 'symbolic-ref read/write roundtrip' '
> +	git symbolic-ref HEAD refs/heads/read-write-roundtrip &&
> +	echo refs/heads/read-write-roundtrip > expect &&

I see SZEDER covered some nits already :)