Last active
December 27, 2015 07:49
-
-
Save jeanlauliac/7292123 to your computer and use it in GitHub Desktop.
Compute git commit volumes for each hour of the week.
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
#!/bin/bash | |
git log --format=format:"%aD" | gawk ' | |
match($0, /^([[:alnum:]]{3}), [[:digit:]]+ [[:alpha:]]{3} \ | |
[[:digit:]]+ ([[:digit:]]+):[[:digit:]]+:[[:digit:]]+/, mt) { | |
days[mt[1]]["count"]++; | |
days[mt[1]]["hours"][+mt[2]]++; | |
total["count"]++; | |
total["hours"][+mt[2]]++; | |
} | |
function print_day(name, day) { | |
printf "%s,%d", name, day["count"]; | |
for (hour = 0; hour < 24; hour++) { | |
printf ",%d", day["hours"][hour]; | |
} | |
printf "\n" | |
} | |
END { | |
for (day in days) | |
print_day(day, days[day]); | |
print_day("total", total); | |
} | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment