Subject: Re: [Outreachy PATCH v2] environment: move "core.attributesFile" into repo-setting

From: Phillip Wood <[email-masked]>
Date: Wed, 7 Jan 2026 10:26:12 +0000

On 06/01/2026 13:44, Bello Olamide wrote:
> On Tue, 6 Jan 2026 at 10:33, Bello Olamide <[email-masked]> wrote:
>>
>> On Mon, 5 Jan 2026 at 23:28, Junio C Hamano <[email-masked]> wrote:
>>>
>>> Phillip Wood <[email-masked]> writes:
>>>
>>>> On 05/01/2026 14:23, Phillip Wood wrote:
>>>>>
>>>>> It is quite common that moving from parsing config settings eagerly by
>>>>> calling repo_config() at startup to parsing them lazily via 'stuct
>>>>> repo_settings' causes regressions like this. We really should find a way
>>>>> to address that before moving more settings into 'struct repo_settings'
>>>>
>>>> See
>>>> https://lore.kernel.org/git/[email-masked]
>>>> for some discussion about a possible solution.
>>>
>>> Nice, but I suspect it would be an improvement already without
>>> passing repository instance via git_default_config() and instead
>>> have the code use the_repository; it is even possible not to have
>>> any repository when the callchain executes.
> 
> But won't this be a temporary solution since the goal is to prevent the use of
> `the_repository`?

Yes but it would be a good start as passing a repository down to 
git_default_config() will be quite invasive. It would certainly be 
better if we can find a solution that uses the repository passed to 
command when it is non-NULL. Unfortunately commands like "git diff 
--no-index" are passed a NULL repository but we have chosen to store our 
config in a `struct repository` and so we need some kind of fake 
repository for those commands. If we stored our config in a separate 
struct we wouldn't need to fake a repository but then we'd have to pass 
the config round separately to the repository which is a pain. Perhaps 
git_default_config() could use `the_repository` when it's given a NULL 
pointer for the callback data.

Thanks

Phillip