Skip to content

Instantly share code, notes, and snippets.

@kechol
Last active September 17, 2017 15:50
Show Gist options
  • Save kechol/d0460d0dd72776487fd1df17422d054d to your computer and use it in GitHub Desktop.
Save kechol/d0460d0dd72776487fd1df17422d054d to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
repos = %w(
dotfiles
)
authors = %w(
kechol
)
options = "--no-merges --ignore-space-change"
period = "1.month"
authors.each do |author|
f, i, d = 0, 0, 0
repos.each do |repo|
# Log format:
# aaabbbccc This is a commit message.
# 1 file changed, 2 insertions(+), 1 deletion(-)
log = `cd #{repo}; git log --shortstat --oneline --author=#{author} --since=#{period} #{options}`
log.lines.each do |log|
next unless log[0] == " "
f += log.scan(/\d+ file/).join.to_i
i += log.scan(/\d+ insertion/).join.to_i
d += log.scan(/\d+ deletion/).join.to_i
end
end
puts [author, f, i, d].join(",")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment