aboutsummaryrefslogtreecommitdiffstats
path: root/roles/obsd_cgit/files/post-receive.d
diff options
context:
space:
mode:
authorEugene Triguba <hello@eugenetriguba.com>2026-11-14 11:31:00 -0800
committerEugene Triguba <hello@eugenetriguba.com>2026-11-14 11:31:00 -0800
commit8e16d8d0907780a0e85f4de7e9b7f4c03a1b5f12 (patch)
treedf04e16bc8391c0395809bcc9581168e71000f3e /roles/obsd_cgit/files/post-receive.d
parentAdd plain README file as recognized readme for cgit (diff)
downloadsite-configs-main.zip
Generalize post receive hook structure for obsd_gitHEADmain
Diffstat (limited to 'roles/obsd_cgit/files/post-receive.d')
-rw-r--r--roles/obsd_cgit/files/post-receive.d/cgit19
1 files changed, 19 insertions, 0 deletions
diff --git a/roles/obsd_cgit/files/post-receive.d/cgit b/roles/obsd_cgit/files/post-receive.d/cgit
new file mode 100644
index 0000000..34bfda4
--- /dev/null
+++ b/roles/obsd_cgit/files/post-receive.d/cgit
@@ -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"