]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t1401: use tar to snapshot and restore repo state
authorHan-Wen Nienhuys <hanwen@google.com>
Mon, 31 May 2021 16:56:20 +0000 (16:56 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 2 Jun 2021 01:01:54 +0000 (10:01 +0900)
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>
t/t1401-symbolic-ref.sh

index a4ebb0b65fecfada915209cfbc994a1b8ddce439..7a9629fb9f0ecdac070ed07fd04ff4792dba1f5d 100755 (executable)
@@ -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 &&