From: Paul Hänsch Date: Tue, 15 Aug 2023 11:33:05 +0000 (+0200) Subject: <> macro: fallback to filesystem timestamps if revisioning is disabled X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=ade7bf5a0fb735ac515d6f0bfd6e4b169989bc27;p=shellwiki <> macro: fallback to filesystem timestamps if revisioning is disabled --- 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