Skip to content

Commit 22161c7

Browse files
committed
Add script to compute number of authors per year
1 parent 9169bae commit 22161c7

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tools/git/scripts/authors_per_year

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Prints the number of authors per month.
4+
#
5+
# <year> <number_of_authors>
6+
7+
# * `git log`
8+
# - Show logs.
9+
# * `awk '{}'`
10+
# - Compute number of authors per year.
11+
# * `sort -n`
12+
# - Sort in numerical order.
13+
git log --format=format:"%ad %aN" --date=format:"%Y" --use-mailmap | awk '
14+
{
15+
name = $2 $3
16+
key = $1 SUBSEP name
17+
if (key in lines) {
18+
next
19+
}
20+
lines[$1,name] = 1
21+
counts[$1] += 1
22+
}
23+
24+
END {
25+
for (yr in counts) {
26+
print yr OFS counts[yr]
27+
}
28+
}
29+
' | sort -n

0 commit comments

Comments
 (0)