tj.git-extras/bin/git-summary
Tj Holowaychuk 54b1eecd8e typo
2011-08-24 19:29:15 -07:00

25 lines
544 B
Bash
Executable file

#!/bin/sh
COMMITISH=""
test $# -ne 0 && COMMITISH=$@
project=${PWD##*/}
commit_count=`git log --oneline $COMMITISH | wc -l | tr -d ' '`
file_count=`git ls-files | wc -l | tr -d ' '`
authors=`git shortlog -n -s $COMMITISH | awk '
{ args[NR] = $0; sum += $0 }
END {
for (i = 1; i <= NR; ++i) {
printf "%-30s %2.1f%%\n", args[i], 100 * args[i] / sum
}
}'`
echo
echo " project: $project"
echo " commits: $commit_count"
if test "$COMMITISH" = ""; then
echo " files : $file_count"
fi
echo " authors: "
echo "$authors"
echo