grosser (owner)

Revisions

gist: 234560 Download_button fork
public
Public Clone URL: git://gist.github.com/234560.git
Embed All Files: show embed
README.markdown #

Ever wondered how much who adds/removes, its time to find out :D (those are real stats, i just obfuscated the names )

Results

Git scores (in LOC):
mr-add              :  +482273       -9466
justu               :  +286250       -159905
grosser             :  +152384       -323344
another             :  +121257       -82116
naames              :  +104577       -13591
justfor             :  +68716        -72446
example             :  +7795         -4987
andeven             :  +5100         -1730
morenow             :  +4225         -2764
finish              :  +17           -19

Install

Copy init git_stats.rb and ruby git_stats.rb (you can add the names of people who commit with different users into the ’same’ array)

git_stats.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
t = Time.now
 
same = [['name-a','name-b'],['mr fred','fred']]
pipe = open("|git log --shortstat")
author = "unknown"
stats = {}
 
loop do
  line = pipe.readline rescue break
  author = $1 if line =~ /Author\: ([a-z]+) </
  found = same.detect{|a| a.include?(author)}
  author = found.first if found
 
  if line =~ /files changed, (\d+) insertions\(\+\), (\d+) deletions/
    stats[author] ||= Hash.new(0)
    stats[author]['+']+=$1.to_i
    stats[author]['-']+=$2.to_i
    print '.'
  end
end
 
puts "\nGit scores (in LOC):"
puts stats.sort_by{|a,d| -d['+'] }.map{|author, data| "#{author.ljust(20)}: +#{data['+'].to_s.ljust(10)} -#{data['-'].to_s.ljust(10)} " } * "\n"