aboutsummaryrefslogtreecommitdiffstats
path: root/git-stats.sh
blob: 3a9f83422a02e0dadbd929bd2fe493fac6d1f60a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'

function usage () {
	echo "Usage: $0 path/to/git/repository"
}

if [ $# != 1 ]; then
	usage
	exit 1
fi


GIT_REPO=$1

cd $GIT_REPO

shortlog=$(git shortlog -ns --no-merges)

echo "$shortlog" | awk '{
	for (i = 2; i <= NF; i++) {
		printf "%s", $i
		if (i != NF) printf " "
	}
	printf ":%s\n", $1
}' | asciigraph  -l "$1" --color