Last active
August 29, 2015 14:03
-
-
Save bblanchon/48702b151a500eddd001 to your computer and use it in GitHub Desktop.
GIT: build a CSV with the number of file vs time
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 | |
OUTPUT=stats.csv | |
[ -f $OUTPUT ] || echo "date;sln;proj;cs;cpp" > $OUTPUT | |
count() { | |
git ls-tree -r --name-only $COMMIT | grep -e $1 | wc -l | sed 's/ //g' | |
} | |
git log --pretty="%H %cd" --date=short | while read COMMIT DATE | |
do | |
[ "$PREV_DATE" == "$DATE" ] && continue | |
echo $DATE | |
PREV_DATE="$DATE" | |
SLN_COUNT=$(count ".*\.sln$") | |
echo " $SLN_COUNT solutions files" | |
PROJ_COUNT=$(count ".*\.[a-z]*proj$") | |
echo " $PROJ_COUNT project files" | |
CS_COUNT=$(count ".*\.cs$") | |
echo " $CS_COUNT C# files" | |
CPP_COUNT=$(count ".*\.\(c\|cpp\|cc\|h\|hpp\|hh\)$") | |
echo " $CPP_COUNT C/C++ files" | |
echo "$DATE;$SLN_COUNT;$PROJ_COUNT;$CS_COUNT;$CPP_COUNT" >> $OUTPUT | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment