Skip to content

Commit 00ccd0e

Browse files
committed
Add script to compute the number of authors per month
1 parent 0a1802e commit 00ccd0e

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tools/git/scripts/authors_per_month

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Prints the number of authors per month.
4+
#
5+
# <weekday> <month> <year> <number_of_authors>
6+
7+
# * `git log`
8+
# - Show logs.
9+
# * `awk '{}'`
10+
# - Compute number of authors per month.
11+
# * `sort -k1n -k2M`
12+
# - Sort the year numerically and sort the second key as a month.
13+
# * `awk '{}'`
14+
# - Format the output.
15+
git log --format=format:"%ad %aN" --date=format:"%b %Y" --use-mailmap | awk '
16+
{
17+
mon = $1 OFS $2
18+
name = $3 $4
19+
key = mon SUBSEP name
20+
if (key in lines) {
21+
next
22+
}
23+
lines[mon,name] = 1
24+
counts[mon] += 1
25+
}
26+
27+
END {
28+
for (mon in counts) {
29+
print mon OFS counts[mon]
30+
}
31+
}
32+
' | sort -k2n -k1M

0 commit comments

Comments
 (0)