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. Furthermore, two tests are converted to not delete HEAD
anymore, as this results in a broken repository. They've instead been
updated to create a non-mandatory symbolic reference and delete that
one instead.
Some tests remain which exercise behaviour with broken references, which
cannot currently be converted to use regular git tooling.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Patrick Steinhardt4 years agocommitted byJunio C Hamano
@ -48,17 +48,17 @@ test_expect_success "fail to delete $m with stale ref" '
@@ -48,17 +48,17 @@ test_expect_success "fail to delete $m with stale ref" '
test $B = "$(git show-ref -s --verify $m)"
'
test_expect_success "delete $m" '
test_when_finished "rm -f .git/$m" &&
test_when_finished "git update-ref -d $m" &&
git update-ref -d $m $B &&
test_path_is_missing .git/$m
test_must_fail git show-ref --verify -q $m
'
test_expect_success "delete $m without oldvalue verification" '
test_when_finished "rm -f .git/$m" &&
test_when_finished "git update-ref -d $m" &&
git update-ref $m $A &&
test $A = $(git show-ref -s --verify $m) &&
git update-ref -d $m &&
test_path_is_missing .git/$m
test_must_fail git show-ref --verify -q $m
'
test_expect_success "fail to create $n" '
@ -80,26 +80,26 @@ test_expect_success "fail to delete $m (by HEAD) with stale ref" '
@@ -80,26 +80,26 @@ test_expect_success "fail to delete $m (by HEAD) with stale ref" '
test $B = $(git show-ref -s --verify $m)
'
test_expect_success "delete $m (by HEAD)" '
test_when_finished "rm -f .git/$m" &&
test_when_finished "git update-ref -d $m" &&
git update-ref -d HEAD $B &&
test_path_is_missing .git/$m
test_must_fail git show-ref --verify -q $m
'
test_expect_success "deleting current branch adds message to HEAD's log" '
test_when_finished "rm -f .git/$m" &&
test_when_finished "git update-ref -d $m" &&
git update-ref $m $A &&
git symbolic-ref HEAD $m &&
git update-ref -m delete-$m -d $m &&
test_path_is_missing .git/$m &&
test_must_fail git show-ref --verify -q $m &&
grep "delete-$m$" .git/logs/HEAD
'
test_expect_success "deleting by HEAD adds message to HEAD's log" '