Created
May 20, 2019 19:47
-
-
Save temochka/bf30842f943e2a6b40dfe865ca8e752d to your computer and use it in GitHub Desktop.
Print often changed files and dirs.
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
#!/usr/bin/env ruby | |
# pipe the following command into this script: | |
# git log --pretty=format: --name-only | most-changed-dirs | |
counts = Hash.new { |hash, k| hash[k] = 0 } | |
while (filename = gets) | |
next if filename.start_with?('@') | |
parts = filename.strip.split(File::SEPARATOR).reject(&:empty?) | |
2.upto(parts.size) do |i| | |
counts[parts.take(i+1).join(File::SEPARATOR)] += 1 | |
end | |
end | |
counts.sort_by { |k, v| -v }.take(100).each do |filename, count| | |
puts " #{count}\t\t#{filename}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment