Config reader does not support includeIf
If the .gitconfig file includes an includeIf directive, the config parser doesn't respect it.
~/.gitconfig file contents:
[includeIf "gitdir:~/work/git/"]
path = ~/.gitconfig.work
[user]
email = [email protected]
name = Me
useconfigonly = true
~/.gitconfig.work contents
[user]
email: [email protected]
name = Work
Change to the ~/work/git/project directory and run git config -l and notice that the name is set to Work. Running the following in a Python REPL
import os
from git import Repo
repo = Repo(os.getcwd())
repo.repo.config_reader().get_value("user", "name")
'Me'
And if the user hasn't got a default user setting in the ~/gitconfig file, it will throw ConfigParser.NoSectionError: No section: 'user' which is expected.
Config parser should support the includeIf directive in the config file.
Thanks for the summary!
As the implementation does support include directives already, at least in theory that should provide the necessary infrastructure to add support for conditional includes.
Here is the a link to the git documentation in case anyone wants to give it a try.
@Byron I just submitted a PR: #1054
Let me know if I missed anything!