diff options
context:
space:
mode:
Diffstat (limited to 'custom/hooks/post-receive.cgit-age')
-rwxr-xr-xcustom/hooks/post-receive.cgit-age25
1 file changed, 10 insertions, 15 deletions
diff --git a/custom/hooks/post-receive.cgit-age b/custom/hooks/post-receive.cgit-age
index 48b17fc..0567e08 100755
--- a/custom/hooks/post-receive.cgit-age
+++ b/custom/hooks/post-receive.cgit-age
@@ -1,14 +1,9 @@
#!/bin/sh
-#
-# Example hook that updates the "age-file" cgit reads for the idle column.
-#
-# This hook assumes that you are using the default age-file location of
-# "info/web/last-modified". If you change the value in your cgitrc then you
-# must also change it here.
-#
-# To install the hook, copy (or link) it to the file "hooks/post-receive" in
-# each of your repositories.
-#
+
+# Updates the age-file cgit reads for the idle column. The path below is the
+# default age-file, so a cgitrc that changes the setting needs the same change
+# here. To install the hook, copy or link it to hooks/post-receive in each
+# repository.
set -eu
@@ -19,14 +14,14 @@ umask 022
agefile="$(git rev-parse --git-dir)"/info/web/last-modified
# Committer dates rather than author dates, so a push of rebased or imported
-# history still counts as recent activity. Branch tips only, since an
-# annotated tag carries no committer date of its own and would sort in as an
-# empty line.
-date="$(git for-each-ref --sort=-committerdate --count=1 --format='%(committerdate:iso8601)' refs/heads/)"
+# history still counts as recent activity. Branch tips only, since an annotated
+# tag carries no committer date of its own and would sort in as an empty line.
+date="$(git for-each-ref --sort=-committerdate --count=1 \
+ --format='%(committerdate:iso8601)' refs/heads/)"
# A repository with no branches keeps whatever cgit already had, rather than
# being handed an empty file.
-[ -n "$date" ] || exit 0
+test -n "$date" || exit 0
mkdir -p "$(dirname "$agefile")"