Skip to content

Config reader does not support includeIf #1053

Open
@Svenito

Description

@Svenito

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions