t1413: use tar to save and restore entire .git directory

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>

Han-Wen Nienhuys committed May 31, 2021 at 16:56 UTC 1142746cbbf016fe2568076d6f30b2b73b29e731
1 file changed +2 -3
t/t1413-reflog-detach.sh
+2 -3
@@ -7,8 +7,7 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
7 . ./test-lib.sh
8
9 reset_state () {
10 - git checkout main &&
11 - cp saved_reflog .git/logs/HEAD
10 + rm -rf .git && "$TAR" xf .git-saved.tar
11 }
12
13 test_expect_success setup '
@@ -17,7 +16,7 @@ test_expect_success setup '
16 git branch side &&
17 test_tick &&
18 git commit --allow-empty -m second &&
20 - cat .git/logs/HEAD >saved_reflog
19 + "$TAR" cf .git-saved.tar .git
20 '
21
22 test_expect_success baseline '