Re: [PATCH 05/18] t1413: use tar to save and restore entire .git directory
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 20, 2021, 22:51 UTC
- Message-ID
- <xmqqfszk36z8.fsf@gitster.g>
- In-Reply-To
- <223583594c0089ef259e83f2f10c08fd94f55959.1618829583.git.gitgitgadget@gmail.com>
"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 20 quoted lines
> 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..b699c2bb7c31 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.tarUnlike GNUism longer option names like "tar --extract", you do not need a single dash when you ask "tar xf" (see our Makefile).
Looking at t/t5000-tar-tree.sh, we seem to be supposed to use "$TAR" (with double quotes) to name the tar utility, so that people can say TAR=gtar on certain platforms. I suspect that there already are a few existing violations but let's not make it worse.
Show 9 quoted lines
> } > > 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
Likewise
"$TAR" cf ...