Skip to content

Commit a41cdb4

Browse files
committed
new config option which can be used more than once to exclude file paths from stats.
1 parent db76e6b commit a41cdb4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

gitstats

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ conf = {
4747
'linear_linestats': 1,
4848
'project_name': '',
4949
'processes': 8,
50-
'start_date': ''
50+
'start_date': '',
51+
'exclude_paths': [],
5152
}
5253

5354
def getpipeoutput(cmds, quiet = False):
@@ -490,6 +491,14 @@ class GitDataCollector(DataCollector):
490491
size = int(parts[3])
491492
fullpath = parts[4]
492493

494+
exclude = False
495+
for path in conf['exclude_paths']:
496+
if path in fullpath:
497+
exclude = True
498+
break
499+
if exclude:
500+
continue
501+
493502
self.total_size += size
494503
self.total_files += 1
495504

@@ -1424,6 +1433,8 @@ class GitStats:
14241433
raise KeyError('no such key "%s" in config' % key)
14251434
if isinstance(conf[key], int):
14261435
conf[key] = int(value)
1436+
elif isinstance(conf[key], list):
1437+
conf[key].append(value)
14271438
else:
14281439
conf[key] = value
14291440
elif o in ('-h', '--help'):

0 commit comments

Comments
 (0)