Last active
December 17, 2015 11:29
-
-
Save zzak/5602892 to your computer and use it in GitHub Desktop.
Commits by size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'git' | |
num_commits = 20000 | |
sizes = {:s => 0, :m => 0, :l => 0, :xl => 0, :xxl => 0} | |
Git.open('.').log(num_commits).author('zzak').each do |commit| | |
log = `git show --numstat #{commit.sha}` | |
stat = 0 | |
log.scan(/^(\d+)\t(\d+)/).flatten.each { |i| stat += i.to_i } | |
case stat | |
when 1..20 | |
sizes[:s] += 1 | |
when 20..50 | |
sizes[:m] += 1 | |
when 50..100 | |
sizes[:l] += 1 | |
when 100..1000 | |
sizes[:xl] += 1 | |
else | |
sizes[:xxl] += 1 | |
end | |
end | |
puts <<-eol | |
Commits by number of lines changed by zzak | |
1-20 : #{sizes[:s]} | |
20-50 : #{sizes[:m]} | |
50-100 : #{sizes[:l]} | |
100-1000 : #{sizes[:xl]} | |
1000+ : #{sizes[:xxl]} | |
eol |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Commits by number of lines changed by zzak | |
1-20 : 127 | |
20-50 : 36 | |
50-100 : 16 | |
100-1000 : 34 | |
1000+ : 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment