aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/git-stats.sh
blob: 2ee1d61d0e1294fb8841e6276d9a88bf0725a0dc (plain) (blame)
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
29
30
31
32
33
34
35
36
37
38
#!/bin/bash

set -e
set -o pipefail

columns="Author,Commits,Changed Files,Insertions,Deletions"

git shortlog -sn "$@" |
while read -r commits author; do
	git log --author="$author" --pretty=tformat: --numstat "$@" | {
		adds=0
		subs=0
		files=0
		while read -r a s f; do
			adds=$((adds + a))
			subs=$((subs + s))
			files=$((files + 1))
		done
		printf '%s;%d;%d;%+d;%+d;\n' \
			"$author" "$commits" "$files" "$adds" "-$subs"
	}
done |
column -t -s ';' -N "$columns" -R "${columns#*,}" |
sed -r 's/[[:space:]]+$//'

echo

columns="Reviewer/Tester,Commits"

git shortlog -sn \
	--group=trailer:acked-by \
	--group=trailer:tested-by \
	--group=trailer:reviewed-by "$@" |
while read -r commits author; do
	printf '%s;%s\n' "$author" "$commits"
done |
column -t -s ';' -N "$columns" -R "${columns#*,}" |
sed -r 's/[[:space:]]+$//'