aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKylie McClain <kylie@somas.is>2020-07-01 05:47:03 -0400
committerKylie McClain <kylie@somas.is>2020-07-01 05:47:03 -0400
commitad38d0f1bd8e8a645e0bb710e9a275dab9e63f07 (patch)
tree45a53c0ffb22f54375d806b8eec64478b41c32fb
parent20ff931cb0f4614ee089cea4c350acc5bba704aa (diff)
downloadgitolite-admin-ad38d0f1bd8e8a645e0bb710e9a275dab9e63f07.tar.gz
gitolite-admin-ad38d0f1bd8e8a645e0bb710e9a275dab9e63f07.tar.xz
gitolite-admin-ad38d0f1bd8e8a645e0bb710e9a275dab9e63f07.zip
cgit-agefile: port to execline
-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."