Re: [PATCH v3 1/4] t1400: avoid touching refs on filesystem
On Wed, Nov 11, 2020 at 07:58:38AM +0100, Patrick Steinhardt wrote:
Show 19 quoted lines
> The testcase t1400 exercises the git-update-ref(1) utility. To do so,
> many tests directly read and write references via the filesystem,
> assuming that we always use loose and/or packed references. While this
> is true now, it'll change with the introduction of the reftable backend.
>
> Convert those tests to use git-update-ref(1) and git-show-ref(1) where
> possible. As some tests exercise behaviour with broken references and
> neither of those tools actually allows writing or reading broken
> references, this commit doesn't adjust all tests.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> t/t1400-update-ref.sh | 72 +++++++++++++++++++++++--------------------
> 1 file changed, 39 insertions(+), 33 deletions(-)
>
> diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
> index 4c01e08551..d7a57488ed 100755
> --- a/t/t1400-update-ref.sh
> +++ b/t/t1400-update-ref.sh
Show 6 quoted lines
> @@ -188,27 +194,26 @@ test_expect_success "move $m (by HEAD)" '
> test $B = $(git show-ref -s --verify $m)
> '
> test_expect_success "delete $m (by HEAD) should remove both packed and loose $m" '
> - test_when_finished "rm -f .git/$m" &&
> + test_when_finished "rm -f git update-ref -d $m" &&
There is a leftover 'rm -f' here.
Show 5 quoted lines
> git update-ref -d HEAD $B &&
> ! grep "$m" .git/packed-refs &&
> - test_path_is_missing .git/$m
> + test_must_fail git show-ref --verify -q $m
> '