t1401: use tar to snapshot and restore repo state

This is agnostic to the ref storage format

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Han-Wen Nienhuys 2021-05-31 16:56:20 +00:00 committed by Junio C Hamano
parent dd8468ef00
commit 9910cbb6f9

View File

@ -7,9 +7,16 @@ test_description='basic symbolic-ref tests'
# the git repo, meaning that further tests will operate on
# the surrounding git repo instead of the trash directory.
reset_to_sane() {
echo ref: refs/heads/foo >.git/HEAD
rm -rf .git &&
"$TAR" xf .git.tar
}
test_expect_success 'setup' '
git symbolic-ref HEAD refs/heads/foo &&
test_commit file &&
"$TAR" cf .git.tar .git/
'
test_expect_success 'symbolic-ref writes HEAD' '
git symbolic-ref HEAD refs/heads/foo &&
echo ref: refs/heads/foo >expect &&