File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -851,13 +851,14 @@ def collect(self) -> Iterator[Union[nodes.Item, nodes.Collector]]:
851
851
if argpath .is_dir ():
852
852
assert not names , f"invalid arg { (argpath , names )!r} "
853
853
854
- # Match the argpath from the root, e.g.
854
+ paths = [argpath ]
855
+ # Add relevant parents of the path, from the root, e.g.
855
856
# /a/b/c.py -> [/, /a, /a/b, /a/b/c.py]
856
- paths = [ * reversed ( argpath . parents ), argpath ]
857
- # Paths outside of the confcutdir should not be considered, unless
858
- # it's the argpath itself.
859
- while len ( paths ) > 1 and not pm . _is_in_confcutdir ( paths [ 0 ]):
860
- paths = paths [ 1 :]
857
+ # Paths outside of the confcutdir should not be considered.
858
+ for path in argpath . parents :
859
+ if not pm . _is_in_confcutdir ( path ):
860
+ break
861
+ paths . insert ( 0 , path )
861
862
862
863
# Start going over the parts from the root, collecting each level
863
864
# and discarding all nodes which don't match the level's part.
You can’t perform that action at this time.
0 commit comments