File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -661,7 +661,8 @@ def read(self) -> None: # type: ignore[override]
661661 continue
662662 # END ignore relative paths if we don't know the configuration file path
663663 file_path = cast (PathLike , file_path )
664- assert osp .isabs (file_path ), "Need absolute paths to be sure our cycle checks will work"
664+ if not osp .isabs (file_path ):
665+ file_path = osp .abspath (file_path )
665666 include_path = osp .join (osp .dirname (file_path ), include_path )
666667 # END make include path absolute
667668 include_path = osp .normpath (include_path )
Original file line number Diff line number Diff line change @@ -246,6 +246,17 @@ def check_test_value(cr, value):
246246 with GitConfigParser (fpa , read_only = True ) as cr :
247247 check_test_value (cr , tv )
248248
249+ @with_rw_directory
250+ def test_relative_include_with_relative_config_path (self , rw_dir ):
251+ fpa = osp .join (rw_dir , "a" )
252+ fpb = osp .join (rw_dir , "b" )
253+ with GitConfigParser (fpb , read_only = False ) as cw :
254+ cw .set_value ("b" , "value" , "b" )
255+ with GitConfigParser (fpa , read_only = False ) as cw :
256+ cw .set_value ("include" , "path" , "b" )
257+ with GitConfigParser (osp .relpath (fpa ), read_only = True ) as cr :
258+ assert cr .get_value ("b" , "value" ) == "b"
259+
249260 @with_rw_directory
250261 def test_multiple_include_paths_with_same_key (self , rw_dir ):
251262 """Test that multiple 'path' entries under [include] are all respected.
You can’t perform that action at this time.
0 commit comments