Skip to content

Commit 0d3816b

Browse files
committed
Add script to compute number of files changed per weekday
1 parent c368d4d commit 0d3816b

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Prints the number of files changed per weekday.
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+
# - Extract the commit timestamp and number of files changed.
15+
# * `perl -pe ''`
16+
# - Convert each Unix timestamp to a date string.
17+
# * `awk '{}'`
18+
# - Tabulate the weekday totals.
19+
"${shortstats}" | awk '{print $1 OFS $4}' | perl -pe 's/(\d+)/gmtime($1)/e' | awk '
20+
BEGIN {
21+
split("Mon Tue Wed Thu Fri Sat Sun", days);
22+
}
23+
{
24+
lines[$1] += $6
25+
}
26+
END {
27+
for ( i = 1; i <= 7; i++ ) {
28+
print days[i] OFS lines[days[i]]
29+
}
30+
}'

0 commit comments

Comments
 (0)