diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2026-11-14 00:41:29 -0800 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2026-11-14 09:44:49 -0800 |
| commit | dfb248d9c3135d83bc84676b57a876275dcccee1 (patch) | |
| tree | ba2db2cba35caa76b9e5da6f0beff09709cb7b24 /roles/obsd_git/templates | |
| parent | Add ipv6 handling (diff) | |
| download | site-configs-dfb248d9c3135d83bc84676b57a876275dcccee1.zip | |
Add post-receive git hook to set last-modified file for cgit
Diffstat (limited to 'roles/obsd_git/templates')
| -rw-r--r-- | roles/obsd_git/templates/gitconfig | 2 | ||||
| -rw-r--r-- | roles/obsd_git/templates/hooks/post-receive | 19 |
2 files changed, 21 insertions, 0 deletions
diff --git a/roles/obsd_git/templates/gitconfig b/roles/obsd_git/templates/gitconfig new file mode 100644 index 0000000..078361d --- /dev/null +++ b/roles/obsd_git/templates/gitconfig @@ -0,0 +1,2 @@ +[core] + hooksPath = {{ obsd_git_hooks_dir }} diff --git a/roles/obsd_git/templates/hooks/post-receive b/roles/obsd_git/templates/hooks/post-receive new file mode 100644 index 0000000..34bfda4 --- /dev/null +++ b/roles/obsd_git/templates/hooks/post-receive @@ -0,0 +1,19 @@ +#!/bin/sh +set -o errexit +set -o nounset + +# $ man cgitrc +# ... +# agefile +# Specifies a path, relative to each repository path, which can be used +# to specify the date and time of the youngest commit in the +# repository. The first line in the file is used as input to the +# "parse_date" function in libgit. Recommended timestamp-format is +# "yyyy-mm-dd hh:mm:ss". You may want to generate this file from a +# post-receive hook. Default value: "info/web/last-modified". +agefile="$(git rev-parse --git-dir)"/info/web/last-modified +mkdir -p "$(dirname "$agefile")" && + git for-each-ref \ + --sort=-authordate --count=1 \ + --format='%(authordate:iso8601)' \ + >"$agefile" |