Skip to content

Instantly share code, notes, and snippets.

@ke4qqq
Created January 10, 2014 16:53
Show Gist options
  • Save ke4qqq/8357973 to your computer and use it in GitHub Desktop.
Save ke4qqq/8357973 to your computer and use it in GitHub Desktop.
LOC per committer per a year
#!/bin/sh
declare -A map
while read line; do
if grep "^[a-zA-Z]" <<< "$line" > /dev/null; then
current="$line"
if [ -z "${map[$current]}" ]; then
map[$current]=0
fi
elif grep "^[0-9]" <<<"$line" >/dev/null; then
for i in $(cut -f 1,2 <<< "$line"); do
map[$current]=$((map[$current] + $i))
done
fi
done <<< "$(git log --numstat -w -b --no-merges --after={2013-01-01} --before={2013-12-31} --pretty="%aN")"
for i in "${!map[@]}"; do
echo -e "$i:${map[$i]}"
done | sort -nr -t ":" -k 2 | column -t -s ":"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment