We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 10fbf0b commit 6d60f0dCopy full SHA for 6d60f0d
1 file changed
tools/git/scripts/additions_per_hour
@@ -0,0 +1,28 @@
1
+#!/usr/bin/env bash
2
+#
3
+# Prints the number of additions per hour.
4
+
5
+# Determine root directory:
6
+root="$(git rev-parse --show-toplevel)"
7
8
+# Define the path to a utility to generate commit short stats:
9
+shortstats="${root}/tools/git/scripts/shortstats"
10
11
+# * `shortstats`
12
+# - Get summary statistics for each commit.
13
+# * `awk '{}'`
14
+# - Tabulate the hourly totals.
15
+# * `sort -n`
16
+# - Sort in numerical order.
17
+"${shortstats}" | awk '
18
+{
19
+ split($4, time, ":")
20
+ hr = time[1]
21
+ lines[hr] += $9
22
+}
23
+END {
24
+ for (hr in lines) {
25
+ print hr OFS lines[hr]
26
+ }
27
28
+' | sort -n
0 commit comments