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>
Han-Wen Nienhuys committed
May 31, 2021 at 16:56 UTC
9910cbb6f988341001ded0c879fb54865a19d592
1 file changed
+8
-1
t/t1401-symbolic-ref.sh
+8
-1
@@ -7,9 +7,16 @@ test_description='basic symbolic-ref tests'
7
# the git repo, meaning that further tests will operate on
8
# the surrounding git repo instead of the trash directory.
9
reset_to_sane() {
10
- echo ref: refs/heads/foo >.git/HEAD
10
+ rm -rf .git &&
11
+ "$TAR" xf .git.tar
12
}
13
14
+test_expect_success 'setup' '
15
+ git symbolic-ref HEAD refs/heads/foo &&
16
+ test_commit file &&
17
+ "$TAR" cf .git.tar .git/
18
+'
19
+
20
test_expect_success 'symbolic-ref writes HEAD' '
21
git symbolic-ref HEAD refs/heads/foo &&
22
echo ref: refs/heads/foo >expect &&