Subject: Re: [PATCH] Provide config option to expect files outside sparse patterns

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Mon, 21 Feb 2022 23:53:08 +0100

On Mon, Feb 21 2022, Johannes Schindelin wrote:

> Hi Elijah,
>
> In addition to Stolee's feedback...
>
> On Sun, 20 Feb 2022, Elijah Newren via GitGitGadget wrote:
>
>> diff --git a/config.c b/config.c
>> index 2bffa8d4a01..68e877a1d80 100644
>> --- a/config.c
>> +++ b/config.c
>> @@ -1520,6 +1520,11 @@ static int git_default_core_config(const char *var, const char *value, void *cb)
>>  		return 0;
>>  	}
>>
>> +	if (!strcmp(var, "core.expectfilesoutsidesparsepatterns")) {
>> +		core_expect_files_outside_sparse_patterns = git_config_bool(var, value);
>> +		return 0;
>> +	}
>
> The `core` section is already quite crowded (for which I am partially
> responsible, of course).
>
> Maybe it would be a good idea to introduce the `sparse` section, using
> `sparse.allowFilesMatchingPatterns` or `sparse.applyPatternsToWorktree =
> false`?

There's a large list of exceptions to this, but generally we have core.*
for cross-command configuration, and <cmd>.* for command-specific
configuration.

Excetions include http.*, mailmap.*, pack.* (arguably), trace2.*.

In this case though we have 2x /^core\.sparse[A-Z].*/ variables in
git-config(1) already.

So perhaps we could name it like that, then at least you'd find all of
these in the same place when looking through that documentation,
although a name starting with "core.sparse" might not be otherwise
ideal.

There's also no law that says we can't have a three-level variable as
core.sparse.*, perhaps that would be the start of a good trend, and it
would sort adjacent to core.sparse[A-Z].* ...