Re: [PATCH v2 3/3] update-ref: add test cases for bare repository
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 26, 2017, 23:41 UTC
- Message-ID
- <xmqqmved1j98.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170126223159.16439-3-cornelius.weig@tngtech.com>
cornelius.weig@tngtech.com writes:
Show 35 quoted lines
> From: Cornelius Weig <cornelius.weig@tngtech.com>
>
> 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 <cornelius.weig@tngtech.com>
> ---
> 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).
Show 9 quoted lines
> 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 > +}