Skip to content

Configparser does not respect order of config files with includes #627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DanielSiepmann opened this issue May 13, 2017 · 1 comment
Closed

Comments

@DanielSiepmann
Copy link

DanielSiepmann commented May 13, 2017

When you have an include statement in the user .gitconfig there content will take precedence over the local .git/config of the repository.

E.g. the following code:
entry = repo.config_reader().get_value('gitlab', 'url')

With the following config setup:

~/.gitconfig:

[include]
    path = ~/.gitconfig-local
[gitlab]
    url = url1

~/.gitconfig-local:

[gitlab]
    url = url2

.git/config:

[gitlab]
    url = url3

Will return url2 I would expect to receive url3 instead as local config should take precedence as the include was in a more global config.

Looks like the issue resides inside the read function e.g.

files_to_read.append(include_path)
will just add the includes to the list, which is just wrong, as they should be read instantly to overwrite just the already known configs.

As the function is just to big, I'm not able to provide a fix.

Versions in use:

>>> import git; git.__version__
'2.1.3'
python --version
Python 2.7.13
@Byron
Copy link
Member

Byron commented May 28, 2017

@DanielSiepmann Thanks for the detailed description, and for the fix! Please have a look at my review - I hope to be able to merge the fix soon and create a new release accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants