Subject: Re: [PATCH v2 3/3] update-ref: add test cases for bare repository

From: Junio C Hamano <[email-masked]>
Date: Thu, 26 Jan 2017 15:41:55 -0800

[email-masked] writes:

> From: Cornelius Weig <[email-masked]>
>
> The default behavior of update-ref to create reflogs differs in
> repositories with worktree and bare ones. The existing tests cover only
> the behavior of repositories with worktree.
>
> This commit adds tests that assert the correct behavior in bare
> repositories for update-ref. Two cases are covered:
>
>  - If core.logAllRefUpdates is not set, no reflogs should be created
>  - If core.logAllRefUpdates is true, reflogs should be created
>
> Signed-off-by: Cornelius Weig <[email-masked]>
> ---
>  t/t1400-update-ref.sh | 43 ++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 36 insertions(+), 7 deletions(-)
>
> diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
> index b9084ca..bad88c8 100755
> --- a/t/t1400-update-ref.sh
> +++ b/t/t1400-update-ref.sh
> @@ -8,23 +8,33 @@ test_description='Test git update-ref and basic ref logging'
>  
>  Z=$_z40
>  
> -test_expect_success setup '
> +m=refs/heads/master
> +n_dir=refs/heads/gu
> +n=$n_dir/fixes
> +outside=refs/foo
> +bare=bare-repo
>  
> +create_test_objects ()
> +{
> +	local T, sha1, prfx="$1"

CodingGuidelines.  Do not use bash-ism "local" (besides, I do not
think you want to have comma here).

>  	for name in A B C D E F
>  	do
>  		test_tick &&
>  		T=$(git write-tree) &&
>  		sha1=$(echo $name | git commit-tree $T) &&
> -		eval $name=$sha1
> +		eval $prfx$name=$sha1
>  	done
> +}