diff mbox series

[v3,05/22] t1401: use tar to snapshot and restore repo state

Message ID 12d43ff6a9e534f3c57f2f811b8b7e1c85e26bdf.1622480197.git.gitgitgadget@gmail.com (mailing list archive)
State Accepted
Commit 9910cbb6f988341001ded0c879fb54865a19d592
Headers show
Series Prepare tests for reftable backend | expand

Commit Message

Han-Wen Nienhuys May 31, 2021, 4:56 p.m. UTC
From: Han-Wen Nienhuys <hanwen@google.com>

This is agnostic to the ref storage format

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 t/t1401-symbolic-ref.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/t/t1401-symbolic-ref.sh b/t/t1401-symbolic-ref.sh
index a4ebb0b65fec..7a9629fb9f0e 100755
--- a/t/t1401-symbolic-ref.sh
+++ b/t/t1401-symbolic-ref.sh
@@ -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 &&