Subject: Re: [PATCH v2 0/7] tests: don't depend on "git init" using the template

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Sat, 04 Jun 2022 02:41:16 +0200

On Fri, Jun 03 2022, Junio C Hamano wrote:

> Ævar Arnfjörð Bjarmason  <[email-masked]> writes:
>
>> This reduced-in-scope re-roll of [1] changes those tests that
>> implicitly relied on the existence of the default "git init" template
>> to no longer do so. This makes the intent of the tests more explicit,
>> e.g. in the case of the .git/branch directory.
>>
>> Parts of the v1 were already split up, re-rolled and merged as
>> a5bf611cc4f (Merge branch 'ab/hook-tests-updates', 2022-03-30).
>>
>> Future goals: I then have a local topic on top of this to add the
>> "--no-template" option to "git init", and to have the test suite run
>> in that mode by default, that's currently one of the blockers for
>> making the test run without the bin-wrappers[2], which as noted in [3]
>> leaves us with some blind spots in our tests.
>>
>> But for now this is all relatively straightforward conversion of
>> existing tests to make them not rely on "git init" giving them a
>> template, which they opt-in to with a new TEST_CREATE_REPO_NO_TEMPLATE
>> variable.
>>
>> Junio: There's a trivial conflict in one of the tests with "next",
>> i.e.:
>
> Heh.  That is good to know, but I am not sure why we need to run
> without template to begin with, so "why this much churn?" is my
> first reaction.  Without the churn in the first place, we do not
> have to worry about unnecessary conflicts ;-).

A few reasons:

 * We currently lack test coverage due to the bin-wrappers, as noted in
   the "remove cwd" topic, i.e. we couldn't easily test our own $PWD
   behavior because we run tests through a shell.

 * It's also much slower, as detailed in the linked thread(s).

 * When I do a full test run I get ~790MB of accumulated trash (if I
   have the tests not remove "trash directory"*), out of that ~168MB or
   more than 20% is just 'hooks' directories.

   Particularly on boxes with slower I/O (including CI) that really adds
   up.

 * Since the original submission we've fixed the bug I found in the
   sparse-checkout code where it had a hard reliance on our default
   templates, which "init" and "clone" allow you to customize.

   So having our tests provide you these by default leaves the door open
   to other such bugs, better to not rely on that at all.

   This series doesn't get us there, i.e. the default is still to
   provide them, but with these changes it'll be trivial to flip that
   switch in the follow-up series.

But yeah, this doesn't give us much more than churn *right now*, but I
think it's worth having these because the end goals above make sense,
and if I'm going to include the eventual benefits in one series that'll
be a much larger topic that'll be harder to review. I'd much prefer to
split up some trivial "prep" work first.

Thanks.