Subject: Re: ab/test-without-templates

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Mon, 27 Jun 2022 14:29:50 +0200

On Thu, Jun 23 2022, Junio C Hamano wrote:

> Ævar Arnfjörð Bjarmason <[email-masked]> writes:
>
>> On Wed, Jun 22 2022, Junio C Hamano wrote:
>>
>>> * ab/test-without-templates (2022-06-06) 7 commits
>>>  - tests: don't assume a .git/info for .git/info/sparse-checkout
>>>  - tests: don't assume a .git/info for .git/info/exclude
>>>  - tests: don't assume a .git/info for .git/info/refs
>>>  - tests: don't assume a .git/info for .git/info/attributes
>>>  - tests: don't assume a .git/info for .git/info/grafts
>>>  - tests: don't depend on template-created .git/branches
>>>  - t0008: don't rely on default ".git/info/exclude"
>>>
>>>  Tweak tests so that they still work when the "git init" template
>>>  did not create .git/info directory.
>>>
>>>  Will merge to 'next'?
>>>  source: <[email-masked]>
>>
>> Presumably the submitters vote doesn't count for much, but FWIW I think
>> it's ready & that there's nothing outstanding left to address.
>
> I do not think they make any particular test to break, but I do not
> think it is a good idea overall to give a false impression to the
> users that it is OK to use incomplete templates that lack things
> expected by Git in properly initialized repositories.  And these
> patches definitely take things in that wrong direction.

In the CL I mentioned some "future goals" goals that you may or may not
agree with, to elaborate on [1]:

 - Eventually running the whole test suite without "git init" creating
   repositories with templates.

 - Running without the bin-wrappers, which as mentions allows us to run
   faster, and improves our test coverage (it's hard to test some
   aspects of invoking "git", when really we're invoking a shellscript
   that invokes git).

 - Having some config option or other handy way to "git init" without
   templates (just formalizing the existing "--template=" invocation).

You may disagree with some or all of those, but this series doesn't try
to get you to agree with any of them. It's just making our tests more
sturdy and explicit in their intent by clearly declaring which parts of
them are relying on our default templates.

So it's helping us spot issues like the one fixed in 7f44842ac19
(sparse-checkout: create leading directory, 2022-01-21) earlier.

I really don't disagree with you per-se about us defining some minimum
viable template, and declaring that pointing --template=* to an empty
directory is unsupported.

But I think it's unarguable that the status quo is leaving our users in
limbo on that question. Neither git-init(1) nor gitrepository-layout(5)
etc. cover that question.

Now, I think based on unsubmitted patches I've wrote that just handling
those cases in code is easier. I.e. it's a small matter of adding a
"mkdir x/y" before we create "x/y", and almost all of that code is code
we have already, so we're mostly supporting the "empty dir" template
model.

But I'm not trying to argue for that here, nor is this series. What this
series does is make it easier to avoid bugs and unexpected behavior in
that are, whatever your position on the "minmum viable template"
question is.

1. https://lore.kernel.org/git/[email-masked]/