Compute memecount for HEAD if newer than the days first commit - bitreich-memestats - Bitreich meme statistics and graphs.
 (HTM) git clone git://bitreich.org/bitreich-memestats git://hg6vgqziawt5s4dj.onion/bitreich-memestats
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Tags
 (DIR) LICENSE
       ---
 (DIR) commit 515a782a49be5f27bed0050438b6a75a9a577a51
 (DIR) parent 9093a18858fbbc08bc3423e258eba8a87e94f7cd
 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
       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(-)
       ---
 (DIR) diff --git a/extract-memecount.sh b/extract-memecount.sh
       @@ -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" | \
       @@ -32,13 +33,15 @@ git log --pretty='format:%H %cd %at' --date="format:%Y-%m-%d" | \
        
                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" = "$headcommit" ]; then
        
                                if [ "$i" -eq 1 ]; then
       -                                dn_dt="$(awk \
       -                                        -v n0="$n0" -v t0="$t0" -v n="$n" -v t="$timestamp" \
       -                                        '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="$n" -v t="$timestamp" \
       +                                                'BEGIN{print (n-n0)/(t-t0)*3600.0*24.0}')"
       +                                fi
                                else
                                        dn_dt=0
                                        i=1