Skip to content

Commit

Permalink
Detect issue 64
Browse files Browse the repository at this point in the history
  • Loading branch information
cpburnz committed Nov 10, 2022
1 parent 6043106 commit a19166b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pathspec/gitignore.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
from .pattern import (
Pattern)
from .patterns.gitwildmatch import (
GitWildMatchPattern)
GitWildMatchPattern,
GitWildMatchPatternError)
from .util import (
_is_iterable)

Expand Down Expand Up @@ -101,7 +102,15 @@ def _match_file(
# Pattern matched.

# Check for directory marker.
dir_mark = match.match.group('ps_d')
try:
dir_mark = match.match.group('ps_d')
except IndexError as e:
# NOTICE: The exact content of this error message is subject
# to change.
raise GitWildMatchPatternError((
"Bad git pattern encountered: file={!r} regex={!r} match={!r}."
).format(file, pattern.regex, match.match)) from e

if dir_mark:
# Pattern matched by a directory pattern.
priority = 1
Expand Down

0 comments on commit a19166b

Please sign in to comment.