瀏覽代碼

Properly handle empty commits with no changes.

Clear files, inserted and deleted after storing them for the preceding commit.

git-svn, for example, can have empty commits (when a directory is created),
causing the statistics to get skewed.

[hoxu@users.sf.net: rewrote commit message based on Tyler's mail]

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
Tyler Nielsen 15 年之前
父節點
當前提交
6f5314e993
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1
    0
      gitstats

+ 1
- 0
gitstats 查看文件

409
 							self.authors[author] = { 'lines_added' : 0, 'lines_removed' : 0 }
409
 							self.authors[author] = { 'lines_added' : 0, 'lines_removed' : 0 }
410
 						self.authors[author]['lines_added'] = self.authors[author].get('lines_added', 0) + inserted
410
 						self.authors[author]['lines_added'] = self.authors[author].get('lines_added', 0) + inserted
411
 						self.authors[author]['lines_removed'] = self.authors[author].get('lines_removed', 0) + deleted
411
 						self.authors[author]['lines_removed'] = self.authors[author].get('lines_removed', 0) + deleted
412
+						files, inserted, deleted = 0, 0, 0
412
 					except ValueError:
413
 					except ValueError:
413
 						print 'Warning: unexpected line "%s"' % line
414
 						print 'Warning: unexpected line "%s"' % line
414
 				else:
415
 				else: