@@ -464,35 +464,37 @@ def _included_paths(self):
464464paths += self .items (section )
465465
466466match = CONDITIONAL_INCLUDE_REGEXP .search (section )
467- if match is not None and self ._repo is not None :
468- keyword = match .group (1 )
469- value = match .group (2 ).strip ()
470-
471- if keyword in ["gitdir" ,"gitdir/i" ]:
472- value = osp .expanduser (value )
473-
474- if not any (value .startswith (s )for s in ["./" ,"/" ]):
475- value = "**/" + value
476- if value .endswith ("/" ):
477- value += "**"
478-
479- # Ensure that glob is always case insensitive if required.
480- if keyword .endswith ("/i" ):
481- value = re .sub (
482- r"[a-zA-Z]" ,
483- lambda m :"[{}{}]" .format (
484- m .group ().lower (),
485- m .group ().upper ()
486- ),
487- value
488- )
489-
490- if fnmatch .fnmatchcase (self ._repo .git_dir ,value ):
491- paths += self .items (section )
492-
493- elif keyword == "onbranch" :
494- if fnmatch .fnmatchcase (self ._repo .active_branch .name ,value ):
495- paths += self .items (section )
467+ if match is None or self ._repo is None :
468+ continue
469+
470+ keyword = match .group (1 )
471+ value = match .group (2 ).strip ()
472+
473+ if keyword in ["gitdir" ,"gitdir/i" ]:
474+ value = osp .expanduser (value )
475+
476+ if not any (value .startswith (s )for s in ["./" ,"/" ]):
477+ value = "**/" + value
478+ if value .endswith ("/" ):
479+ value += "**"
480+
481+ # Ensure that glob is always case insensitive if required.
482+ if keyword .endswith ("/i" ):
483+ value = re .sub (
484+ r"[a-zA-Z]" ,
485+ lambda m :"[{}{}]" .format (
486+ m .group ().lower (),
487+ m .group ().upper ()
488+ ),
489+ value
490+ )
491+
492+ if fnmatch .fnmatchcase (self ._repo .git_dir ,value ):
493+ paths += self .items (section )
494+
495+ elif keyword == "onbranch" :
496+ if fnmatch .fnmatchcase (self ._repo .active_branch .name ,value ):
497+ paths += self .items (section )
496498
497499return paths
498500