From 9cb14f1991f211b03daa10cad61757f1eed1468d Mon Sep 17 00:00:00 2001 From: Brandon High Date: Tue, 29 Jul 2014 13:37:46 -0700 Subject: [PATCH] Trailing slash should catch directories 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. --- pathspec/gitignore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pathspec/gitignore.py b/pathspec/gitignore.py index bdb63f6..2b44cbd 100644 --- a/pathspec/gitignore.py +++ b/pathspec/gitignore.py @@ -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.