aboutsummaryrefslogtreecommitdiffstats
path: root/Summary
blob: fb0a1ea38387bc93c9c1500e4fe8eca8ec5e63dc (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh

tmp=.git/summary-$$
trap 'rm -f $tmp-*' 0

since="$1"
until="$2"

case 0 in
1)
	bottom=$(git rev-parse master@{"$1"})
	top=$(git rev-parse master@{"$2"})
	;;
0)
	git rev-list --first-parent --since="$since" --until="$until" \
		master >"$tmp-1" &&
	bottom=$(tail -n 1 "$tmp-1") &&
	top=$(head -n 1 "$tmp-1") &&
	rm -f "$tmp-1"
	;;
esac

num_patches=$(git rev-list --no-merges $bottom..$top | wc -l)
git shortlog -s -n --no-merges $bottom..$top >"$tmp-0.txt"
num_contrib=$(wc -l <"$tmp-0.txt")

summary=$(git diff --stat -M $bottom..$top | tail -n 1)
num_files=$(expr "$summary" : ' *\([1-9][0-9]*\) files changed')
num_added=$(expr "$summary" : '.*changed, \([1-9][0-9]*\) insertions')
num_deleted=$(expr "$summary" : '.*, \([1-9][0-9]*\) deletions')

cat <<EOF
During the period of $since .. $until:

	Number of contributors  : $num_contrib
	Number of change sets   : $num_patches
	Number of changed files : $num_files
	Number of added lines   : $num_added
	Number of deleted lines : $num_deleted

Changes during this period are as follows:

EOF

git --no-pager shortlog -w72,2,4 --no-merges $bottom..$top

git --no-pager diff --dirstat $bottom..$top