From 84155e2ebd54bd2dd07d1a920894496db75707c1 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sun, 7 Nov 2021 05:36:31 +0100 Subject: [PATCH] index: retrieve git log from cached text include While git is fast, it still results in a ~50ms command for an otherwise static ~5ms landing page. Run `make -B UPDATE` as post-commit git hook (and post-rewrite, and post-checkout) on live checkouts. --- .gitignore | 1 + Makefile | 5 ++++- index.plp | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d579771..142f46a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ # derived contents /sitemap.xml /light.css +/UPDATE /plan.plp /word/*.min.js diff --git a/Makefile b/Makefile index e635f5f..aaf9283 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -all: sitemap.xml light.css plan.plp data/digraphs.inc.pl data/unicode-cover.inc.pl data/countries.inc.pl data/browser data/termcol-xcolor.inc.pl data/digraphs-xorg.inc.pl word +all: sitemap.xml light.css plan.plp UPDATE data/digraphs.inc.pl data/unicode-cover.inc.pl data/countries.inc.pl data/browser data/termcol-xcolor.inc.pl data/digraphs-xorg.inc.pl word more: all .PHONY: force # applied to download after 2 hours @@ -20,6 +20,9 @@ light.css: tools/stripcss base.css plan.plp: TODO kramdown $< >$@ +UPDATE: $(download) + $(call cmdsave,git log -1 --date=short --pretty="%ad %s") + word: word/put.min.js data/wordlist.en.json data/wordlist.nl.json data/wordlist.ru.json data/wordpairs.json word/put.js: $(download) diff --git a/index.plp b/index.plp index c2e939b..468e927 100644 --- a/index.plp +++ b/index.plp @@ -15,6 +15,7 @@ Html({ ' title="RSS feed of repository updates"', ' href="http://git.shiar.nl/sheet.git/rss">', ], + data => ['UPDATE'], }); :> @@ -28,8 +29,7 @@ Originally created by Mischa Poslawsky, but you're free to use, print, alter, and redistribute under the AGPL license.

<: -my @format = ('--date=short', "--pretty=%ad (%ar)\t%s"); -if (open my $log, '-|', git => 'log', -1, @format) {{ +if (open my $log, '<', 'UPDATE') {{ my $line = readline $log; $line or next; # explicitly ignore empty input EscapeHTML $line; -- 2.30.0