From e5ad2b136b0d0213a46bd3a7a17a05d6208cc3eb Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 14 Aug 2026 12:39:31 -1000 Subject: Rename the agefile hook to `cgit-age` --- custom/hooks/post-receive.agefile | 38 -------------------------------------- custom/hooks/post-receive.cgit-age | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 38 deletions(-) delete mode 100755 custom/hooks/post-receive.agefile create mode 100755 custom/hooks/post-receive.cgit-age (limited to 'custom') diff --git a/custom/hooks/post-receive.agefile b/custom/hooks/post-receive.agefile deleted file mode 100755 index 80c67c2..0000000 --- a/custom/hooks/post-receive.agefile +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# -# Example hook that updates the "agefile" cgit reads for the idle column. -# -# This hook assumes that you are using the default agefile 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. -# - -set -eu - -# The pushing user's umask decides the mode of a freshly written agefile, so -# force one that leaves the file readable by the web server. -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/)" - -# A repository with no branches keeps whatever cgit already had, rather than -# being handed an empty file. -[ -n "$date" ] || exit 0 - -mkdir -p "$(dirname "$agefile")" - -# Write through a temporary file so a reader never sees a half written date. -tmpfile="$agefile.$$" -trap 'rm -f "$tmpfile"' EXIT -printf '%s\n' "$date" >"$tmpfile" -mv "$tmpfile" "$agefile" diff --git a/custom/hooks/post-receive.cgit-age b/custom/hooks/post-receive.cgit-age new file mode 100755 index 0000000..80c67c2 --- /dev/null +++ b/custom/hooks/post-receive.cgit-age @@ -0,0 +1,38 @@ +#!/bin/sh +# +# Example hook that updates the "agefile" cgit reads for the idle column. +# +# This hook assumes that you are using the default agefile 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. +# + +set -eu + +# The pushing user's umask decides the mode of a freshly written agefile, so +# force one that leaves the file readable by the web server. +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/)" + +# A repository with no branches keeps whatever cgit already had, rather than +# being handed an empty file. +[ -n "$date" ] || exit 0 + +mkdir -p "$(dirname "$agefile")" + +# Write through a temporary file so a reader never sees a half written date. +tmpfile="$agefile.$$" +trap 'rm -f "$tmpfile"' EXIT +printf '%s\n' "$date" >"$tmpfile" +mv "$tmpfile" "$agefile" -- cgit v2.8.0