File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -2034,12 +2034,13 @@ def _get_parent_directory(self, path_segments):
20342034
20352035 current = self .root
20362036 for segment in path_segments :
2037- existing = resources_by_path .get (segment )
2038- if not existing :
2037+ path = posixpath_join (current .path , segment )
2038+ existing = resources_by_path .get (path )
2039+ if not existing or existing == Codebase .CACHED_RESOURCE :
20392040 existing = self ._get_or_create_resource (
20402041 name = segment ,
20412042 # build the path based on parent
2042- path = posixpath_join ( current . path , segment ) ,
2043+ path = path ,
20432044 parent = current ,
20442045 is_file = False ,
20452046 )
Original file line number Diff line number Diff line change @@ -1451,6 +1451,18 @@ def test_VirtualCodebase_can_be_created_without_RecursionError(self):
14511451 test_file = self .get_test_loc ('resource/virtual_codebase/zephyr-binary.json' )
14521452 VirtualCodebase (test_file )
14531453
1454+ def test_VirtualCodebase_can_be_created_with_repeated_root_directory (self ):
1455+ paths = [
1456+ 'to' ,
1457+ 'to/to' ,
1458+ 'to/to/to' ,
1459+ 'to/to/to/to' ,
1460+ ]
1461+ resources = [{'path' : path } for path in paths ]
1462+ vc = VirtualCodebase (location = {'files' : resources })
1463+ walked_paths = [r .path for r in vc .walk ()]
1464+ assert paths == walked_paths
1465+
14541466
14551467class TestResource (FileBasedTesting ):
14561468 test_data_dir = join (dirname (__file__ ), 'data' )
You can’t perform that action at this time.
0 commit comments