Visitar URL original
GitConfigParser ignores multiple [include] paths · Issue #2099 · gitpython-developers/GitPython · GitHub
Skip to content

GitConfigParser ignores multiple [include] paths #2099

Description

@gibfahn

git help config says (emphasis mine):

Includes
The include and includeIf sections allow you to include config directives from another source. These sections behave identically to each other with the exception that includeIf sections may be ignored if their condition does not evaluate to true; see "Conditional includes"
below.

 You can include a config file from another by setting the special include.path (or includeIf.*.path) variable to the name of the file to be included. The variable takes a pathname as its value, and is subject to tilde expansion. **These variables can be given multiple times.**

Which means this is a valid config:

[include]
  path = ~/.config/git/maintenance.config
  path = ~/.config/git/my-config

But this isn't handled by GitPython today, only one path entry is returned.

Activity

  1. gibfahn commented on Jan 19, 2026

    @gibfahn
    Author

    From some quick testing the issue seems to be in the _included_paths() function:

    GitPython/git/config.py

    Lines 554 to 556 in 57bbea9

    for section in self.sections():
    if section == "include":
    paths += self.items(section)

    and changing self.items(section) → self.items_all(section) starts returning all the values:

    >>> self.items(section)
    [('path', '~/.config/git/my-config')]
    >>> self.items_all(section)
    [('path', ['~/.config/git/maintenance.config', '~/.config/git/my-config'])]

    but I'm not sure whether this is the right fix.

  2. Byron commented on Jan 19, 2026

    @Byron
    Member

    Thanks a lot for researching this!

    Even though this might not be the final fix, I think this is a step in the right direction.
    Maybe you can put something together, ideally with a test - a PR would be very welcome.

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

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