From ade7bf5a0fb735ac515d6f0bfd6e4b169989bc27 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Tue, 15 Aug 2023 13:33:05 +0200 Subject: [PATCH] <> macro: fallback to filesystem timestamps if revisioning is disabled --- macros/changes | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/macros/changes b/macros/changes index c1e6946..562fa8f 100755 --- a/macros/changes +++ b/macros/changes @@ -23,21 +23,27 @@ page_glob "$glob" "$depth" |while read page; do acl_read "${page_abs}" || continue read ostamp odate <<-EOF - $(git -C "$_DATA" log --pretty="format:%at %ai" -- "pages${page_abs}#page.md") + $([ "$REV_PAGES" = true ] \ + && git -C "$_DATA" log --pretty="format:%at %ai" -- "pages${page_abs}#page.md" \ + || stat -c "%Y %y" -- "$_DATA/pages${page_abs}#page.md" + ) EOF - row="$(HTML "$page")${odate%% +*}" + row="$(HTML "$page")${odate%%[+.]*}" rowstate='' for l in $LANGUAGES; do if [ -f "${_DATA}/pages/${page}:${l}/#page.md" ]; then read lstamp ldate <<-EOF - $(git -C "$_DATA" log --pretty="format:%at %ai" -- "pages$(page_abs "${page_abs}:${l}")/#page.md") + $([ "$REV_PAGES" = true ] \ + && git -C "$_DATA" log --pretty="format:%at %ai" -- "pages$(page_abs "${page_abs}:${l}")/#page.md" \ + || stat -c "%Y %y" -- "$_DATA/pages$(page_abs "${page_abs}:${l}")/#page.md" + ) EOF if [ $lstamp -lt $ostamp ] 2>&-; then - row="${row}outdated${ldate%% +*}" + row="${row}outdated${ldate%%[+.]*}" [ "$rowstate" = "${rowstate%*outdated*}" ] && rowstate="${rowstate}${rowstate:+ }outdated" else - row="${row}current${ldate%% +*}" + row="${row}current${ldate%%[+.]*}" [ "$rowstate" = "${rowstate%*current*}" ] && rowstate="${rowstate}${rowstate:+ }current" fi else -- 2.39.2