Re: [PATCH] Provide config option to expect files outside sparse patterns
- From
Derrick Stolee <derrickstolee@github.com>
- Date
- Feb 22, 2022, 13:47 UTC
- Message-ID
- <d33e3253-dc2f-18a7-04b7-2c8a44405f6b@github.com>
- In-Reply-To
- <CABPp-BH_fJYWSySh_-Pk5w2j7U2q4CAXi_mEextmmd4YBXOiGg@mail.gmail.com>
On 2/21/2022 9:23 PM, Elijah Newren wrote:
Show 46 quoted lines
> On Mon, Feb 21, 2022 at 12:34 PM Johannes Schindelin
> <Johannes.Schindelin@gmx.de> 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`?
>
> That's a fair point. At one point Stolee wanted to change from
> core.sparse* to sparse.* -- but by that point we already had users and
> would have had to deal with a bit of a migration story (and wondering
> what to do if people had both old and new config variables set
> inconsistently).
>
> I'm not sure if it's optimal to try to keep the sparse settings
> together (thus put new ones under core), or try to avoid filling core.
> I guess if we moved towards sparse.* now, it might be an easier
> migration story if we only have two options to move. And besides,
> we're already split between multiple sections with
> extensions.worktreeConfig, core.sparseCheckout{,Cone}, and
> index.sparse already...so maybe adding one more section would be par
> for the course. ;-)
>
> So, I'm leaning towards sparse.expectFilesOutsideOfPatterns, but I'd
> like to hear Stolee's thoughts too.This has been an interesting discussion.
I think that the existence of core.sparseCheckout[Cone] isn't a good reason to keep adding to the core.* namespace. Creating a sparse.* namespace is a good idea. I doubt this will be the last time we want a config option for some behavior custom to sparse-checkouts (or virtual environments).
I agree that migrating core.sparseCheckout[Cone] to the sparse.* namespace would need to be done carefully. In particular, we would probably need to _always_ understand the core.* versions, but start to prefer the sparse.* versions if there is a conflict. This work could be delayed indefinitely, or could be offered as a project for a new contributor (if we experienced contributors could agree on a clear path to make this transition).
Thanks, -Stolee