Skip to content

Commit 836e4cd

Browse files
committed
ignore: solve re.error on group name redefinition in pathspec 0.10.x
Remove regex concatenation that causes re.error Fixes #8217
1 parent f5699ce commit 836e4cd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dvc/ignore.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(self, pattern_list, dirname, sep):
4040
]
4141

4242
self.ignore_spec = [
43-
(ignore, re.compile("|".join(item[0] for item in group)))
43+
(ignore, [re.compile(item[0]) for item in group])
4444
for ignore, group in groupby(
4545
self.regex_pattern_list, lambda x: x[1]
4646
)
@@ -107,8 +107,8 @@ def matches(pattern, path, is_dir) -> bool:
107107

108108
result = False
109109

110-
for ignore, pattern in self.ignore_spec[::-1]:
111-
if matches(pattern, path, is_dir):
110+
for ignore, patterns in self.ignore_spec[::-1]:
111+
if any(matches(pattern, path, is_dir) for pattern in patterns):
112112
result = ignore
113113
break
114114
return result

0 commit comments

Comments
 (0)