Skip to content

Instantly share code, notes, and snippets.

@foolip
Created September 11, 2017 11:09
Show Gist options
  • Save foolip/ec37321054284cf075dfeb496fddf643 to your computer and use it in GitHub Desktop.
Save foolip/ec37321054284cf075dfeb496fddf643 to your computer and use it in GitHub Desktop.
#!/bin/bash -e
SINCE="2017-04-10T00:00Z"
# --since uses the committer date and we use UTC cutoffs, so other date handling
# must also use commiter dates in UTC.
export TZ=UTC
(
find * -maxdepth 0 -type d | grep -v '^css$'
find css -mindepth 1 -maxdepth 1 -type d
) | while read d; do
FILE_COUNT=`find $d -type f | wc -l`
# du uses 512 byte blocks and thus inflates the size by a lot
#FILE_SIZE=`du -k $d | tail -1 | awk '{print $1}'`
FILE_SIZE=`find $d -type f -print0 | xargs -0 cat | wc -c`
TOP_COMMITTERS=`git log --no-merges --pretty=%ae --since=$SINCE -- $d/ | sort | uniq -c | sort -n -r | head -3 | awk '{print $2}'`
# in in metric html, tools and webrtc come out on top, matching my hunches
COMMIT_COUNT=`git rev-list --no-merges --count --since=$SINCE HEAD -- $d/`
# in this metric html, service-workers and tools come out on top
DAYS_OF_ACTIVITY=`git log --no-merges --pretty=%cd --date=iso-local --since=$SINCE -- $d/ | cut -c1-10 | sort | uniq | wc -l`
# in this metric core-aam and others with low commit count and day-to-day activity come out on top
#TOUCHED_FILE_COUNT=`git log --no-merges --pretty="" --name-only --since=$SINCE HEAD -- $d/ | wc -l`
printf '%-30s %8s %8s %8s %8s %s\n' $d $FILE_COUNT $FILE_SIZE $COMMIT_COUNT $DAYS_OF_ACTIVITY "$(echo $TOP_COMMITTERS)"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment