extract-memecount.sh: exit gracefully if memecount.log is up to date - 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 e5ead53b455dbe7e7da13ca55e6a52b736aa2de5 (DIR) parent 59cc23745f7cb078911587bfaf9a729f69118c30 (HTM) Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Mon, 30 Aug 2021 18:36:30 +0200 extract-memecount.sh: exit gracefully if memecount.log is up to date Signed-off-by: Christoph Lohmann <20h@r-36.net> Diffstat: M extract-memecount.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- (DIR) diff --git a/extract-memecount.sh b/extract-memecount.sh @@ -12,6 +12,7 @@ memefile="modules/hashtags/hashtags.txt" update_annna=yes outputfile="${2:-memecount.log}" revisionrange="" +datefmt="%Y-%m-%d" if [ ! -e "${annnadir}/${memefile}" ]; then printf 'error: could not open %s\n' "${annnadir}/${memefile}" @@ -21,6 +22,9 @@ fi if [ -f "${outputfile}" ]; then lastrevision="$(tail -n 1 "${outputfile}" | cut -f 2)" revisionrange="${lastrevision}..HEAD" + if [ "$(date +"${datefmt}")" = "$(tail -n 1 "${outputfile}" | cut -f 1)" ]; then + exit + fi else firstrevision="$(cd "${annnadir}" && git rev-list --max-parents=0 HEAD)" revisionrange="${firstrevision}..HEAD" @@ -41,7 +45,7 @@ fi headcommit="$(git rev-parse HEAD)" i=0 # derived from Hiltjo Posthuma's loc.sh -(cd "${annnadir}" && git log --pretty='format:%H %cd %at' --date="format:%Y-%m-%d" \ +(cd "${annnadir}" && git log --pretty='format:%H %cd %at' --date="format:${datefmt}" \ "${revisionrange}") | \ sort -k 2 | uniq -f 1 | \ while read -r commit date timestamp; do