diff --git a/gitstats b/gitstats index c71b0e4..05dabd5 100755 --- a/gitstats +++ b/gitstats @@ -124,14 +124,14 @@ def getnumoffilesfromrev(time_rev): Get number of files changed in commit """ time, rev = time_rev - return (int(time), rev, int(getpipeoutput(['git ls-tree -r --name-only "%s"' % rev, 'wc -l']).split('\n')[0])) + return (int(time), rev, int(getpipeoutput(['git ls-tree -r --name-only "%s"' % rev, ('find /c /v ""', 'wc -l')[ON_LINUX]]).split('\n')[0])) def getnumoflinesinblob(ext_blob): """ Get number of lines in blob """ ext, blob_id = ext_blob - return (ext, blob_id, int(getpipeoutput(['git cat-file blob %s' % blob_id, 'wc -l']).split()[0])) + return (ext, blob_id, int(getpipeoutput(['git cat-file blob %s' % blob_id, ('find /c /v ""', 'wc -l')[ON_LINUX]]).split()[0])) class DataCollector: """Manages data collection from a revision control repository.""" @@ -286,10 +286,10 @@ class GitDataCollector(DataCollector): def collect(self, dir): DataCollector.collect(self, dir) - self.total_authors += int(getpipeoutput(['git shortlog -s %s' % getlogrange(), 'wc -l'])) - #self.total_lines = int(getoutput('git-ls-files -z |xargs -0 cat |wc -l')) + self.total_authors += int(getpipeoutput(['git shortlog -s %s' % getlogrange(), ('find /c /v ""', 'wc -l')[ON_LINUX]])) + #self.total_lines = int(getoutput('git-ls-files -z |xargs -0 cat |find /c /v ""')) - # tags + # tags lines = getpipeoutput(['git show-ref --tags']).split('\n') for line in lines: if len(line) == 0: @@ -327,7 +327,7 @@ class GitDataCollector(DataCollector): # Collect revision statistics # Outputs "