26 lines
1.0 KiB
Bash
Executable File
26 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
function getInsertA {
|
|
git log --author="$1" --no-merges --oneline --shortstat | grep "insertions" | cut -d " " -f5 | sed '/^$/d' | paste -sd+ | bc
|
|
}
|
|
|
|
function getDeleteA {
|
|
git log --author="$1" --no-merges --oneline --shortstat | grep "deletions" | cut -d " " -f7 | sed '/^$/d' | paste -sd+ | bc
|
|
}
|
|
|
|
#author list
|
|
author=$(git log --format="%aN" | sort | uniq)
|
|
insertsALL=$(git log --no-merges --oneline --shortstat | grep "insertions" | cut -d " " -f5 | sed '/^$/d' | paste -sd+ | bc)
|
|
deletesALL=$(git log --no-merges --oneline --shortstat | grep "deletions" | cut -d " " -f7 | sed '/^$/d' | paste -sd+ | bc)
|
|
bothALL=$(($insertsALL + $deletesALL))
|
|
|
|
for user in $author; do
|
|
ins=$(getInsertA $user)
|
|
del=$(getDeleteA $user)
|
|
both=$(($ins + $del))
|
|
insp=$(python -c "print (int(($ins./$insertsALL)*1000)/10.)")
|
|
delp=$(python -c "print (int(($del./$deletesALL)*1000)/10.)")
|
|
bothp=$(python -c "print (int(($both./$bothALL)*1000)/10.)")
|
|
echo "$user: $ins ($insp%) insertions, $del ($delp%) deleteions, $both ($bothp%) both"
|
|
done
|