From: Junio C Hamano Date: Thu, 26 Jan 2017 23:41:55 GMT Subject: Re: [PATCH v2 3/3] update-ref: add test cases for bare repository Message-ID: In-Reply-To: <20170126223159.16439-3-cornelius.weig@tngtech.com> cornelius.weig@tngtech.com writes: > From: Cornelius Weig > > 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 > --- > 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 > +}