tCompute memecount for HEAD if newer than the days first commit - bitreich-meme… | |
git clone git://src.adamsgaard.dk/bitreich-memestats | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 515a782a49be5f27bed0050438b6a75a9a577a51 | |
parent 9093a18858fbbc08bc3423e258eba8a87e94f7cd | |
Author: Anders Damsgaard <[email protected]> | |
Date: Sat, 15 Aug 2020 23:01:13 +0200 | |
Compute memecount for HEAD if newer than the days first commit | |
The change in meme count is not re-computed, as the time interval | |
is not going to be a day. | |
Diffstat: | |
M extract-memecount.sh | 13 ++++++++----- | |
1 file changed, 8 insertions(+), 5 deletions(-) | |
--- | |
diff --git a/extract-memecount.sh b/extract-memecount.sh | |
t@@ -15,6 +15,7 @@ if [ "$update_annna" = "yes" ]; then | |
git pull >/dev/null 2>&1 | |
fi | |
+headcommit="$(git rev-parse HEAD)" | |
i=0 | |
# derived from Hiltjo Posthuma's loc.sh | |
git log --pretty='format:%H %cd %at' --date="format:%Y-%m-%d" | \ | |
t@@ -32,13 +33,15 @@ git log --pretty='format:%H %cd %at' --date="format:%Y-%m-… | |
if [ "$n" -gt 1 ]; then | |
- # only one row per day | |
- if [ "$date" != "$lastprintdate" ]; then | |
+ # only one row per day unless the most recent commit is newer | |
+ if [ "$date" != "$lastprintdate" ] || [ "$commit" = "$headcomm… | |
if [ "$i" -eq 1 ]; then | |
- dn_dt="$(awk \ | |
- -v n0="$n0" -v t0="$t0" -v n="$n" -v t… | |
- 'BEGIN{print (n-n0)/(t-t0)*3600.0*24.0… | |
+ if [ "$commit" != "$headcommit" ]; then | |
+ dn_dt="$(awk \ | |
+ -v n0="$n0" -v t0="$t0" -v n="… | |
+ 'BEGIN{print (n-n0)/(t-t0)*360… | |
+ fi | |
else | |
dn_dt=0 | |
i=1 |