aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlocal/hooks/repo-specific/cgit-agefile23
1 files changed, 14 insertions, 9 deletions
diff --git a/local/hooks/repo-specific/cgit-agefile b/local/hooks/repo-specific/cgit-agefile
index 83adfbd..7fb8514 100755
--- a/local/hooks/repo-specific/cgit-agefile
+++ b/local/hooks/repo-specific/cgit-agefile
@@ -1,12 +1,17 @@
-#!/bin/sh
-
+#!/bin/execlineb
# Ensure that the idle time on cgit will be accurate to the last commit.
-# Sourced from <https://git.zx2c4.com/cgit/tree/contrib/hooks/post-receive.agefile>
-agefile="$(git rev-parse --git-dir)"/info/web/last-modified
+# Ported to execline from <https://git.zx2c4.com/cgit/tree/contrib/hooks/post-receive.agefile>.
+
+backtick -in git_dir { git rev-parse --git-dir }
+importas -u git_dir git_dir
+
+define agefile ${git_dir}/info/web/last-modified
+importas -u agefile agefile
-mkdir -p "$(dirname "$agefile")" &&
-git for-each-ref \
- --sort=-authordate --count=1 \
- --format='%(authordate:iso8601)' \
- >"$agefile"
+backtick -in agedir { dirname ${agefile} }
+importas -u agedir agedir
+if { mkdir -p ${agedir} }
+redirfd -w 1 ${agefile}
+if { git for-each-ref --sort=-authordate --count=1 --format='%(authordate:iso8601)' }
+echo "[cgit-agefile] age file updated."