Skip to content

Commit 964388b

Browse files
committed
Add script to calculate deletions per year
1 parent 54add3b commit 964388b

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Prints the number of deletions per year.
4+
#
5+
# <year> <deletions>
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+
lines[$5] += $10
22+
}
23+
END {
24+
for (yr in lines) {
25+
print yr OFS lines[yr]
26+
}
27+
}' | sort -k1n

0 commit comments

Comments
 (0)