]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t1413: use tar to save and restore entire .git directory
authorHan-Wen Nienhuys <hanwen@google.com>
Mon, 31 May 2021 16:56:22 +0000 (16:56 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 2 Jun 2021 01:01:54 +0000 (10:01 +0900)
This makes the test independent of the particulars of the storage formats.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Reviewed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1413-reflog-detach.sh

index bde05208ae6a47f96008a24338d56d9408557467..934688a1ee82e29f2552bb2444eb06626fe254f8 100755 (executable)
@@ -7,8 +7,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 . ./test-lib.sh
 
 reset_state () {
-       git checkout main &&
-       cp saved_reflog .git/logs/HEAD
+       rm -rf .git && "$TAR" xf .git-saved.tar
 }
 
 test_expect_success setup '
@@ -17,7 +16,7 @@ test_expect_success setup '
        git branch side &&
        test_tick &&
        git commit --allow-empty -m second &&
-       cat .git/logs/HEAD >saved_reflog
+       "$TAR" cf .git-saved.tar .git
 '
 
 test_expect_success baseline '