Last active
August 12, 2016 18:08
-
-
Save base698/10943264 to your computer and use it in GitHub Desktop.
Find commits in a workspace for listed languages
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
#!/bin/bash | |
source_reg='\b(scala|cpp|js|java|coffee|rb|java|clj|py|groovy|html|ejs|sh|cljs)\b'; | |
awk_counts='{ | |
counts[tolower($1)]++ | |
} | |
END { | |
for(type in counts) { | |
print(type, counts[type]) | |
} | |
}'; | |
awk_sums='BEGIN {} | |
{ | |
total+=$2; | |
counts[$1]+=$2; | |
} | |
END { | |
printf("%-10s %-8s %-8s \n","type", "commits", "percent"); | |
for(type in counts) { | |
printf("%-10s %-8d %-5.2f \n",type, counts[type], counts[type]*100/total) | |
} | |
}'; | |
find . -type d | while read line | |
do | |
if ls -a "$line" | egrep '^\.git$' | |
then | |
cd "$line" | |
git log -p -E --author="$1" | grep diff | egrep -o "\.[a-zA-Z]{1,8}" | egrep -io "$source_reg" | awk "$awk_counts" | |
cd - | |
fi | |
done | awk "$awk_sums" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
usage: ./stats.sh [email protected]