Last active
December 20, 2015 05:38
-
-
Save takac/6079347 to your computer and use it in GitHub Desktop.
Git Contributor Rank
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
# Contributor Ranking | |
# | |
# Author: Tom Cammann | |
# | |
function contrib_list { | |
# Find all email address names used to commit | |
authors=$( git log --format='%aE' | cut -d"@" -f1 | sort -u ) | |
# For each commit match no binary files that have changed and capture the number | |
# Only match java files | |
for i in ${authors}; do | |
echo "$i" $(git log --author="$i" --no-merges --stat | awk 'BEGIN{ FS="|"} /.*\.java/{match($2, /^ *([0-9]+)/,a); x += a[1] } END { print x }') | |
done | |
} | |
# Create a mapping from username to commit lines | |
# Add differnt cases of names together. | |
n=1 | |
for i in $(contrib_list | awk ' | |
BEGIN{ FS=" " } | |
{a[tolower($1)] += $2 } | |
END{ | |
for( name in a ) | |
print name "=" a[name] | |
}' | sort -t"=" -k2 -rn); do | |
x=$( echo $i | tr "=" " ") | |
echo "${n}. $x" | |
(( n++ )) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment