Closed mih closed 1 week ago
linking a few config manager related issues from core:
More corner/use cases are:
include
directivesThe ping in https://github.com/datalad/datalad/issues/5383 reminded me that the present config manager also has no support for git annex config. And this one is special, because it has a fixed set it items, and rules of "engagement" are more complex
Making a start for this effort now.
https://github.com/datalad/datalad-core/pull/19 provides a new ConfigManager
implementation, built to support all aspects gathered in this issue. Even though, it may not actually support all proposed features at this point.
https://github.com/datalad/datalad-next/pull/760 has an exploration whether it would be possible to implement an adapter for the new manager with the API of the old one. This seems possible, except for some edge cases (some of which a more like bugs than features).
I am closing this issue here. Feature requests can be posted to https://github.com/datalad/datalad-core
This is a key component of any datalad code. It is present in any datalad session
datalad.cfg
and part of anyDataset
or*Repo
instance.The implementation in datalad-core is old, has various spaghetti pieces, and comprises at least 3 different APIs.
I believe this code needs an update for a number of reasons:
git-config
-- ie. no support forworktree
overrides
is clashing with Git's owncommand
scope -- see #325 for the struggle to sort this outGiven the essential nature of this code, I think a replacement must
ConfigManager
dict
, andConfigParser
in Python andConfigParser
in GitPython, and some other pieces) via deprecations resulting actual removalgit-config
in terms of scopes and conceptsTODO:
.gitmodules
) to inform refactoringreplace-all
within a particular scope...)CommandError
to communicate permission issues when setting (e.g. system) configurationThoughts
Maybe have a dataclass
maybe with additional accessors like
section
name
asbool()
asint()
The internal representation within
ConfigManager
could be a list of these items, with amend/overwrite/replace rules applied on access. Or a series of lists, grouped byscope
in adict
(likelyscope
removed fromGitConfigScopeType
then), or even grouped by(scope, origin)
to facilitate reloads.It could also make sense to have an explicit
GitConfigMultiValueItem
, that exposes aget_all()
equivalent, rather than (only) havingConfigManager.get(getall: bool)