diff mbox series

[v2,06/21] t1413: use tar to save and restore entire .git directory

Message ID e4e8fc1d4b4f450d46dd320ffc2398515044b28a.1619519903.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series Prepare tests for reftable backend | expand

Commit Message

Han-Wen Nienhuys April 27, 2021, 10:38 a.m. UTC
From: Han-Wen Nienhuys <hanwen@google.com>

This makes the test independent of the particulars of the storage formats.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 t/t1413-reflog-detach.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Ævar Arnfjörð Bjarmason May 20, 2021, 3:22 p.m. UTC | #1
On Tue, Apr 27 2021, Han-Wen Nienhuys via GitGitGadget wrote:

> From: Han-Wen Nienhuys <hanwen@google.com>
>
> This makes the test independent of the particulars of the storage formats.
>
> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
> ---
>  t/t1413-reflog-detach.sh | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/t/t1413-reflog-detach.sh b/t/t1413-reflog-detach.sh
> index bde05208ae6a..934688a1ee82 100755
> --- a/t/t1413-reflog-detach.sh
> +++ b/t/t1413-reflog-detach.sh
> @@ -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 '

So what I said in 05, but also didn't the commit messages of 05 and 06
get mixed up / bad fixup in a WIP version? I.e. the first commit says
"use symbolic ref", but it's mostly about introducing the use of this
tar/untar pattern.

Whereas this continues the tarring pattern, and doesn't start using it,
and (presumably) is the mis-squashed commit that should have added this
whole tar thing after the first commit does the isolated
s/echo/symbolic-ref/ fix.
Han-Wen Nienhuys May 31, 2021, 3:16 p.m. UTC | #2
On Thu, May 20, 2021 at 5:23 PM Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:

> >  test_expect_success baseline '
>
> So what I said in 05, but also didn't the commit messages of 05 and 06
> get mixed up / bad fixup in a WIP version? I.e. the first commit says
> "use symbolic ref", but it's mostly about introducing the use of this
> tar/untar pattern.
>
> Whereas this continues the tarring pattern, and doesn't start using it,
> and (presumably) is the mis-squashed commit that should have added this
> whole tar thing after the first commit does the isolated
> s/echo/symbolic-ref/ fix.

I've split the commits by test file. I added a separate commit for the
tar use here.
diff mbox series

Patch

diff --git a/t/t1413-reflog-detach.sh b/t/t1413-reflog-detach.sh
index bde05208ae6a..934688a1ee82 100755
--- a/t/t1413-reflog-detach.sh
+++ b/t/t1413-reflog-detach.sh
@@ -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 '