Skip to content

Commit 1c499d9

Browse files
committed
Simplify script
1 parent 62ecac6 commit 1c499d9

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

tools/git/scripts/additions_per_month

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,18 @@ shortstats="${root}/tools/git/scripts/shortstats"
1111
# * `shortstats`
1212
# - Get summary statistics for each commit.
1313
# * `awk '{}'`
14-
# - Extract the commit timestamp and number of additions.
15-
# * `perl -pe ''`
16-
# - Convert each Unix timestamp to a date string.
17-
# * `awk '{}'`
1814
# - Tabulate the monthly totals.
19-
# * `sort -M`
20-
# - Sort by month name.
21-
"${shortstats}" | awk '{print $1 OFS $5}' | perl -pe 's/(\d+)/localtime($1)/e' | awk '
15+
# * `sort -k1n -k2M`
16+
# - Sort the year numerically and sort the second key as a month.
17+
# * `awk '{}'`
18+
# - Format the output.
19+
"${shortstats}" | awk '
2220
{
23-
lines[$2] += $6
21+
mon = $5 OFS $2
22+
lines[mon] += $9
2423
}
2524
END {
2625
for (mon in lines) {
2726
print mon OFS lines[mon]
2827
}
29-
}' | sort -M
28+
}' | sort -k1n -k2M | awk '{print $2 OFS $1 OFS $3}'

0 commit comments

Comments
 (0)