Add "Git monthly" summary script
Junio C Hamano committed
Mar 4, 2007 at 22:30 UTC
8368eb5e07ba704108e9f7f4d795b5c1114043ef
1 file changed
+36
Summary
new
+36
@@ -0,0 +1,36 @@
1
+#!/bin/sh
2
+
3
+tmp=.git/summary-$$
4
+trap 'rm -f $tmp-*' 0
5
+
6
+since="$1"
7
+until="$2"
8
+
9
+git-rev-list --no-merges --since="$1" --until="$2" master >"$tmp-0.txt"
10
+top=$(head -n 1 "$tmp-0.txt")
11
+bottom=$(tail -n 1 "$tmp-0.txt")
12
+
13
+num_patches=$(git rev-list --no-merges $bottom..$top | wc -l)
14
+git shortlog -s -n --no-merges $bottom..$top >"$tmp-0.txt"
15
+num_contrib=$(wc -l <"$tmp-0.txt")
16
+
17
+summary=$(git diff --stat -M $bottom..$top | tail -n 1)
18
+num_files=$(expr "$summary" : ' *\([1-9][0-9]*\) files changed')
19
+num_added=$(expr "$summary" : '.*changed, \([1-9][0-9]*\) insertions')
20
+num_deleted=$(expr "$summary" : '.*, \([1-9][0-9]*\) deletions')
21
+
22
+cat <<EOF
23
+During the period of $since .. $until:
24
+
25
+ Number of contributors : $num_contrib
26
+ Number of change sets : $num_patches
27
+ Number of changed files : $num_files
28
+ Number of added lines : $num_added
29
+ Number of deleted lines : $num_deleted
30
+
31
+Changes during this period are as follows:
32
+
33
+EOF
34
+
35
+git shortlog --no-merges $bottom..$top
36
+