Skip to content

Commit fd10387

Browse files
committed
Adjust glob translation
Ensure we do not recurse for directory name matches, except when ending on **.
1 parent f9abea6 commit fd10387

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

{{cookiecutter.github_project_name}}/setupbase.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,6 @@ def _join_translated(translated_parts, os_sep_class):
596596
This is different from a simple join, as care need to be taken
597597
to allow ** to match ZERO or more directories.
598598
"""
599-
if len(translated_parts) < 2:
600-
return translated_parts[0]
601-
602599
res = ''
603600
for part in translated_parts[:-1]:
604601
if part == '.*':
@@ -607,9 +604,12 @@ def _join_translated(translated_parts, os_sep_class):
607604
res += part
608605
else:
609606
res += part + os_sep_class
607+
610608
if translated_parts[-1] == '.*':
611-
# Final part is **, undefined behavior since we don't check against filesystem
609+
# Final part is **
612610
res += translated_parts[-1]
611+
# Follow stdlib/git convention of matching all sub files/directories:
612+
res += '({os_sep_class}?.*)?'.format(os_sep_class=os_sep_class)
613613
else:
614614
res += translated_parts[-1]
615615
return res

0 commit comments

Comments
 (0)