Skip to content

Config reader does not support includeIf #1053

@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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy