Skip to content

Commit 6d60f0d

Browse files
committed
Add script to compute the number of additions per hour
1 parent 10fbf0b commit 6d60f0d

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)