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

From: Junio C Hamano <[email-masked]>
Date: Tue, 06 Jan 2026 07:24:36 +0900

Phillip Wood <[email-masked]> writes:

> If I run 'git -c core.attributesFile=~does-not-exist rebase -i' with git 
> built from master it fails immediately with "fatal: failed to expand 
> user dir in: '~does-not-exist'".

Hmph, if you call any behaviour change a "regression", this may
certainly count as one, but I do not necessarily think the above is
a good behaviour.

Think about a use case where attributes are not used at all, e.g.,
"git -c core.attributesFile=~does-not-matter cat-file -t HEAD";
would it make sense to barf when your configuration file has an
invalid definition for what you are *not* using?  So if the change
makes it stop barfing, it can even be argued that this is an
improvement.

> 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'

Very true.  If we know the set of things we parse early and have a
way to say "this command only X, Y, and Z matters (but not W)", then
the above cat-file example can omit the attributesFile from the "we
care" set.

I think overusing repo_settings is a disease.  Moving a singleton
global to per repository (by adding to struct repository) is one
thing and it is very welcome.  But changing the way configuration
variables are parsed (e.g., what used to be parsed by only those who
care about is now parsed by everybody, or vice versa) needs to be
handled carefully.