On Thu, May 20, 2021 at 5:21 PM Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> wrote: > But since we're encountering this "reset_to_sane" pattern, can't we just > as easily fix it up with something more obvious than replacing an echo > to a specific ref with a tarring up and untarring of the whole .git each > time? > > I.e. something like: > > # setup the .git initially > > Then: > > test_when_finished "rm -rf copy" && > git clone . copy && > # munge the repo and use "git -C copy" for the tests" I think this is actually worse than tarring up the tree. By using clone, your initial state will be affected by any behavior that git-clone does that makes sense when the user is a human. For example, refs/heads/x is renamed to refs/remotes/origin/x. Also, all the timestamps will be off, which might be a problem if there is infrastructure (index refreshes?) that uses timestamps. By contrast, using tar (re)creates a precise snapshot of the initial state. -- 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 -- 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