Created
June 13, 2014 09:42
-
-
Save arnehormann/b66656d353379073b23c to your computer and use it in GitHub Desktop.
count LOC in .git folders per language
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 | |
set -e -u -o pipefail # -x | |
echo $'Project\tCommit\tBranch\tFiletype\tLines' | |
for dir in *.git; do | |
export GIT_DIR="$dir" | |
export PREFIX=$(git for-each-ref --count=1 --sort=committerdate --format=$'%(objectname)\t%(refname)') | |
export BRANCH=$(echo -e "${PREFIX}" | cut -d $'\t' -f 1) | |
##### from these filetypes ##### | |
for filetype in java cs rb go py as php html htm css js json xml conf cnf; do | |
echo -n -e "${dir}\t${PREFIX}\t${filetype}\t" | |
git --no-pager grep -h "" "${BRANCH}" -- "*.${filetype}" | wc -l || true | |
done | |
done | egrep -v $'\t0$' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment