瀏覽代碼

Workaround for linux-2.6.

Heikki Hokkanen 18 年之前
父節點
當前提交
466c2aea01
共有 1 個檔案被更改,包括 8 行新增2 行删除
  1. 8
    2
      statgit

+ 8
- 2
statgit 查看文件

@@ -85,9 +85,15 @@ class GitDataCollector(DataCollector):
85 85
 		# TODO also collect statistics for "last 30 days"/"last 12 months"
86 86
 		lines = getoutput('git-rev-list --pretty=format:"%at %an" HEAD |grep -v ^commit').split('\n')
87 87
 		for line in lines:
88
+			# linux-2.6 says "<unknown>" for one line O_o
88 89
 			parts = line.split(' ')
89
-			stamp = int(parts[0])
90
-			author = ' '.join(parts[1:])
90
+			author = ''
91
+			try:
92
+				stamp = int(parts[0])
93
+			except ValueError:
94
+				stamp = 0
95
+			if len(parts) > 1:
96
+				author = ' '.join(parts[1:])
91 97
 			date = datetime.datetime.fromtimestamp(float(stamp))
92 98
 
93 99
 			# First and last commit stamp