From 6c7843a1988c1cc7214fea57b7c2c8f7a8d27715 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Feb 2026 08:29:13 +0000 Subject: [PATCH 1/2] Initial plan From 5938ae3510e720e39aeabf4622bcc976a0dc54ca Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Feb 2026 08:32:42 +0000 Subject: [PATCH 2/2] fix: resolve relative includes from relative config paths Co-authored-by: Byron <63622+Byron@users.noreply.github.com> --- git/config.py | 3 ++- test/test_config.py | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/git/config.py b/git/config.py index c6eaf8f7b..b84c648dd 100644 --- a/git/config.py +++ b/git/config.py @@ -661,7 +661,8 @@ def read(self) -> None: # type: ignore[override] continue # END ignore relative paths if we don't know the configuration file path file_path = cast(PathLike, file_path) - assert osp.isabs(file_path), "Need absolute paths to be sure our cycle checks will work" + if not osp.isabs(file_path): + file_path = osp.abspath(file_path) include_path = osp.join(osp.dirname(file_path), include_path) # END make include path absolute include_path = osp.normpath(include_path) diff --git a/test/test_config.py b/test/test_config.py index 11ea52d16..4701c51b3 100644 --- a/test/test_config.py +++ b/test/test_config.py @@ -246,6 +246,17 @@ def check_test_value(cr, value): with GitConfigParser(fpa, read_only=True) as cr: check_test_value(cr, tv) + @with_rw_directory + def test_relative_include_with_relative_config_path(self, rw_dir): + fpa = osp.join(rw_dir, "a") + fpb = osp.join(rw_dir, "b") + with GitConfigParser(fpb, read_only=False) as cw: + cw.set_value("b", "value", "b") + with GitConfigParser(fpa, read_only=False) as cw: + cw.set_value("include", "path", "b") + with GitConfigParser(osp.relpath(fpa), read_only=True) as cr: + assert cr.get_value("b", "value") == "b" + @with_rw_directory def test_multiple_include_paths_with_same_key(self, rw_dir): """Test that multiple 'path' entries under [include] are all respected.