You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 = my@email.com
name = Me
useconfigonly = true
~/.gitconfig.work contents
[user]
email: work@email.com
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.
As the implementation does support include directives already, at least in theory that should provide the necessary infrastructure to add support for conditional includes.
Activity
Byron commentedon Sep 3, 2020
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.
buddly27 commentedon Sep 3, 2020
@Byron I just submitted a PR: #1054
Let me know if I missed anything!