Skip to content

Commit 651b821

Browse files
committed
use exclude_paths as regular expression
1 parent a41cdb4 commit 651b821

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

gitstats

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,10 @@ class GitDataCollector(DataCollector):
477477
except ValueError:
478478
print 'Warning: failed to parse line "%s"' % line
479479

480+
481+
# compile exclude_paths regex
482+
conf['exclude_paths'] = [re.compile(pattern, re.IGNORECASE) for pattern in conf['exclude_paths']]
483+
480484
# extensions and size of files
481485
lines = getpipeoutput(['git ls-tree -r -l -z %s' % getcommitrange('HEAD', end_only = True)]).split('\000')
482486
blobs_to_read = []
@@ -492,11 +496,12 @@ class GitDataCollector(DataCollector):
492496
fullpath = parts[4]
493497

494498
exclude = False
495-
for path in conf['exclude_paths']:
496-
if path in fullpath:
499+
for pattern in conf['exclude_paths']:
500+
if pattern.search(fullpath):
497501
exclude = True
498502
break
499503
if exclude:
504+
print 'Excluding file: %s' % fullpath
500505
continue
501506

502507
self.total_size += size

0 commit comments

Comments
 (0)