Re: [PATCH v3 07/22] t1413: use tar to save and restore entire .git directory
- From
Han-Wen Nienhuys <hanwen@google.com>
- Date
- Jun 1, 2021, 09:23 UTC
- Message-ID
- <CAFQ2z_O2t2cDvTs0aNqB+9FVSy51CKrJxxdvu9WGg1s6gZziHw@mail.gmail.com>
- In-Reply-To
- <51a802ff-0789-4051-6d45-5b9c6e55ba8a@gmail.com>
On Tue, Jun 1, 2021 at 6:55 AM Bagas Sanjaya <bagasdotme@gmail.com> wrote:
Show 17 quoted lines
>
> On 31/05/21 23.56, Han-Wen Nienhuys via GitGitGadget wrote:
> > 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
> > }
> >
>
> Why do you do rm -rf git directory then extract tar archive to reset?I'm not sure I understand your question. Are you asking why we have to do a reset, or why we'd use rm + tar? The rm + tar restores the former state reliably, so we can be sure it is correct. It's also independent of the storage format details.
-- Han-Wen Nienhuys - Google Munich I work 80%. Don't expect answers from me on Fridays. -- Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Paul Manicle, Halimah DeLaine Prado