Created
May 28, 2020 19:08
-
-
Save thearchduke/dca2924cfa34ae605ee09e426756447d to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env ruby | |
# please use 2.4.0+ | |
# Recursively searches your directory of repos to find the specified regex in commit messages, | |
# and produces a histogram by author. | |
# e.g. "./commitsearch.rb 'fu*ck'" | |
authors = [] | |
Dir.glob('*').select { |f| File.directory? f } .sort .each do |d| | |
Dir.chdir(d) do | |
`git checkout master --quiet` | |
raw_authors = `git log -i --grep='#{ARGV[0]}' | grep Author` | |
next unless raw_authors.length > 1 | |
authors += raw_authors.split("\n") | |
end | |
end | |
histogram = authors.group_by(&:itself).transform_values(&:size).sort_by {|_, v| -v} | |
puts histogram.inspect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment