Created
June 3, 2017 01:54
-
-
Save mgiuffrida/538fbd0fb51113e7073bcf54f8f0d31b to your computer and use it in GitHub Desktop.
LOC added to settings by user (only counts "insertions")
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/sh | |
DIRS=( | |
chrome/browser/ui/webui/settings/ | |
chrome/browser/resources/settings/ | |
chrome/test/data/webui/settings/ | |
ui/webui/resources/cr_elements/cr_dialog/ | |
ui/webui/resources/cr_elements/policy/ | |
ui/webui/resources/cr_elements/network/ | |
) | |
FILES=( | |
ui/webui/resources/cr_elements/shared_style_css.html | |
ui/webui/resources/cr_elements/shared_vars_css.html | |
chrome/app/settings_* | |
) | |
set -e | |
START=2015-01-01 | |
END=2017-07-01 | |
COUNTS="" | |
git log --pretty=format:%h --after "$START" --before "$END" -- ${DIRS[@]} | { | |
while read; do | |
commit=$REPLY | |
INSERTIONS=0 | |
#DELETIONS=0 | |
DIFFSTATS=() | |
for dir in ${DIRS[@]}; do | |
DIFFSTATS+=("$(git show "$commit" --stat --relative="$dir" --pretty=oneline)") | |
done | |
for file in ${FILES[@]}; do | |
DIFFSTATS+=("$(git show "$commit" --stat --pretty=oneline "$file")") | |
done | |
for diff in "${DIFFSTATS[@]}"; do | |
if [[ $(echo -e "$diff" | wc -l) -lt 2 ]]; then | |
continue | |
fi | |
DIFFSTAT=$(echo -e "$diff" | tail -n 1) | |
if echo "$DIFFSTAT" | grep -q insertion; then | |
INSERTIONS=$((INSERTIONS + $(echo "$DIFFSTAT" | sed 's%.* \([0-9]*\) insertion.*$%\1%'))) | |
fi | |
done | |
if [[ $INSERTIONS -gt 0 ]]; then | |
AUTHOR=$(git log -n 1 "$commit" --pretty='%ae') | |
COUNTS+="$AUTHOR $INSERTIONS\n" | |
fi | |
done; | |
echo -e "$COUNTS" | awk '{a[$1]+=$2}END{for(i in a) print a[i], i}' | grep -v '^0$' | sort -n | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment