Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions git/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,8 @@ def read(self) -> None: # type: ignore[override]
files_to_read = list(self._file_or_files)
# END ensure we have a copy of the paths to handle

files_to_read = [osp.abspath(path) if isinstance(path, (str, os.PathLike)) else path for path in files_to_read]

seen = set(files_to_read)
num_read_include_files = 0
while files_to_read:
Expand Down
14 changes: 14 additions & 0 deletions test/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,20 @@ def check_test_value(cr, value):
with GitConfigParser(fpa, read_only=True) as cr:
check_test_value(cr, tv)

@with_rw_directory
def test_config_relative_path_include(self, rw_dir):
included_path = osp.join(rw_dir, "included")
with GitConfigParser(included_path, read_only=False) as cw:
cw.set_value("included", "value", "included")

config_path = osp.join(rw_dir, "config")
with GitConfigParser(config_path, read_only=False) as cw:
cw.set_value("include", "path", "included")

relative_config_path = osp.relpath(config_path)
with GitConfigParser(relative_config_path, read_only=True) as cr:
assert cr.get_value("included", "value") == "included"
Comment on lines +313 to +325

@with_rw_directory
def test_multiple_include_paths_with_same_key(self, rw_dir):
"""Test that multiple 'path' entries under [include] are all respected.
Expand Down
Loading