ソースを参照

Fixed escaping for "wc -l".

Heikki Hokkanen 18 年 前
コミット
faf762f4dd
共有1 個のファイルを変更した2 個の追加2 個の削除を含む
  1. 2
    2
      gitstats

+ 2
- 2
gitstats ファイルの表示

@@ -249,8 +249,8 @@ class GitDataCollector(DataCollector):
249 249
 
250 250
 			self.extensions[ext]['files'] += 1
251 251
 			try:
252
-				# FIXME filenames with spaces or special characters are broken
253
-				self.extensions[ext]['lines'] += int(getoutput('wc -l < %s' % line, quiet = True))
252
+				# Escaping could probably be improved here
253
+				self.extensions[ext]['lines'] += int(getoutput('wc -l < %s' % re.sub(r'(\W)', r'\\\1', line)))
254 254
 			except:
255 255
 				print 'Warning: Could not count lines for file "%s"' % line
256 256