We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 70c4700 commit 9907379Copy full SHA for 9907379
1 file changed
tools/git/scripts/author_commits_per_year
@@ -0,0 +1,30 @@
1
+#!/usr/bin/env bash
2
+#
3
+# Prints the number of commits per year per author.
4
5
+# <year> <author_first_name> <author_last_name> <number_of_commits>
6
+
7
+# Determine root directory:
8
+root="$(git rev-parse --show-toplevel)"
9
10
+# Define the path to a utility to generate commit short stats:
11
+shortstats="${root}/tools/git/scripts/shortstats"
12
13
+# * `shortstats`
14
+# - Get summary statistics for each commit.
15
+# * `awk '{}'`
16
+# - Tabulate the yearly totals.
17
+# * `sort -k1n`
18
+# - Sort the year numerically.
19
+"${shortstats}" | awk '
20
+{
21
+ # Update yearly totals per author:
22
+ lines[$5,$6,$7] += 1
23
+}
24
+END {
25
+ for (k in lines) {
26
+ split(k, keys, SUBSEP)
27
+ print keys[1] OFS keys[2] OFS keys[3] OFS lines[k]
28
+ }
29
30
+' | sort -k1n
0 commit comments