File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ #
3+ # Prints the number of additions per day.
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 daily totals.
15+ # * `sort -n`
16+ # - Sort in numeric order.
17+ # * `perl -pe ''`
18+ # - Convert each Unix timestamp to a date string.
19+ # * `awk '{}'`
20+ # - Format the output.
21+ " ${shortstats} " | awk '
22+ BEGIN {
23+ scalar = 60 * 60 * 24
24+ }
25+ {
26+ # Round a Unix timestamp to the nearest day:
27+ ts = int($1/scalar) * scalar
28+
29+ # Update daily totals:
30+ lines[ts] += $5
31+ }
32+ END {
33+ for ( ts in lines ) {
34+ print ts OFS lines[ts]
35+ }
36+ }
37+ ' | sort -n | perl -pe ' s/(\d+)/gmtime($1)/e' | awk ' {print $6 OFS $2 OFS $3 OFS $5}'
You can’t perform that action at this time.
0 commit comments