aboutsummaryrefslogtreecommitdiff
path: root/local/hooks/repo-specific/cgit-agefile
blob: 7fb85141068702835253273cef8e3d0ab53eb185 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/execlineb
# Ensure that the idle time on cgit will be accurate to the last commit.
# 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

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."