Skip to content

Commit

Permalink
Trailing slash should catch directories
Browse files Browse the repository at this point in the history
Found an issue where if you provide a .gitignore line with a trailing slash ('foo/'), it will match files inside but not the directory itself. The .gitignore spec specifies that the directory should be matched as well. This commit changes the end of spec regex to * to fix this issue.
  • Loading branch information
boogles committed Jul 29, 2014
1 parent 6ee8b22 commit 9cb14f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pathspec/gitignore.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def __init__(self, pattern):
elif i == end:
# A normalized pattern ending with double-asterisks ('**')
# will match any trailing path segments.
regex.append('/.+')
regex.append('/.*')
else:
# A pattern with inner double-asterisks ('**') will match
# multiple (or zero) inner path segments.
Expand Down

0 comments on commit 9cb14f1

Please sign in to comment.