Skip to content

Instantly share code, notes, and snippets.

@aerosol
Created February 6, 2012 11:20
Show Gist options
  • Select an option

  • Save aerosol/1751556 to your computer and use it in GitHub Desktop.

Select an option

Save aerosol/1751556 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "Number of commits per author:"
git --no-pager shortlog -sn --all
AUTHORS=$( git shortlog -sn --all | cut -f2 | cut -f1 -d' ')
OVERALL_ADDED=0
OVERALL_DELETED=0
OVERALL_CHANGED=0
for a in $AUTHORS
do
echo "Statistics for: $a"
echo '--------------------------------------------'
echo -n "Number of files changed: "
CHANGED=`git log $LOGOPTS --all --numstat --format="%n" --author=$a | grep -v "mobileexp" | cut -f3 | sort -iu | wc -l`
echo $CHANGED
echo -n "Number of lines added: "
ADDED=`git log $LOGOPTS --all --numstat --format="%n" --author=$a | grep -v "mobileexp" | cut -f1 | awk '{s+=$1} END {print s}'`
echo $ADDED
echo -n "Number of lines deleted: "
DELETED=`git log $LOGOPTS --all --numstat --format="%n" --author=$a | grep -v "mobilexp" | cut -f2 | awk '{s+=$1} END {print s}'`
echo $DELETED
echo -n "Number of merges: "
MERGES=`git log $LOGOPTS --all --merges --author=$a | grep -v "mobilexp" | grep -c '^commit'`
echo $MERGES
echo -n "Coolfactor (the lower, the better): "
echo $[$[$ADDED-$DELETED]/$[$[$CHANGED]]]
echo '--------------------------------------------'
OVERALL_CHANGED=$[$CHANGED + $OVERALL_CHANGED]
OVERALL_DELETED=$[$DELETED + $OVERALL_DELETED]
OVERALL_ADDED=$[$ADDED + $OVERALL_ADDED]
done
echo '========================================================================'
echo "Overall stats:"
echo added $OVERALL_ADDED
echo deleted $OVERALL_DELETED
echo changed $OVERALL_CHANGED
echo '========================================================================'
echo -n "Is project mature? "
OVERALL_COOLNESS=$[$[$OVERALL_ADDED-$OVERALL_DELETED]/$OVERALL_CHANGED]
if [ $OVERALL_COOLNESS -le 0 ]; then
echo "FUCK YES"
else
echo '
__________
< no, sorry >
-----------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment