Diff options
Diffstat (limited to 'custom/hooks')
-rwxr-xr-xcustom/hooks/post-receive.cgit-age15
-rwxr-xr-xcustom/hooks/post-receive.cgit-cache4
-rwxr-xr-xcustom/hooks/post-receive.commit-graph2
3 files changed, 13 insertions, 8 deletions
diff --git a/custom/hooks/post-receive.cgit-age b/custom/hooks/post-receive.cgit-age
index a87e325..82a13f0 100755
--- a/custom/hooks/post-receive.cgit-age
+++ b/custom/hooks/post-receive.cgit-age
@@ -2,8 +2,13 @@
# 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.
+# here. A file the pusher cannot write stays as it was, and nothing here
+# complains or exits non-zero, so the pusher is not shown an error over a stale
+# idle column.
+#
+# To install the hook, copy or link it to hooks/post-receive in each
+# repository. Git runs one post-receive per repository, so fold this together
+# with the other hooks here to have more than one.
set -eu
@@ -32,10 +37,10 @@ date="$(git for-each-ref --sort=-committerdate --count=1 \
# being handed an empty file.
test -n "$date" || exit 0
-mkdir -p "$(dirname "$agefile")"
+mkdir -p "$(dirname "$agefile")" 2>/dev/null || exit 0
# 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"
+{ printf '%s\n' "$date" >"$tmpfile"; } 2>/dev/null || exit 0
+mv "$tmpfile" "$agefile" 2>/dev/null || :
diff --git a/custom/hooks/post-receive.cgit-cache b/custom/hooks/post-receive.cgit-cache
index f1a4b40..61ac1ea 100755
--- a/custom/hooks/post-receive.cgit-cache
+++ b/custom/hooks/post-receive.cgit-cache
@@ -19,12 +19,12 @@
# The path below is the default cache-root, so a cgitrc that changes the
# setting needs the same change here. The web server owns the cache root, so
# the pushing user needs write access to it. Nothing here complains or exits
-# nonzero when that access is missing, so the pusher is not shown an error
+# non-zero when that access is missing, so the pusher is not shown an error
# over a stale page.
#
# To install the hook, copy or link it to hooks/post-receive in each
# repository. Git runs one post-receive per repository, so fold this together
-# with the age-file hook to have both.
+# with the other hooks here to have more than one.
set -eu
diff --git a/custom/hooks/post-receive.commit-graph b/custom/hooks/post-receive.commit-graph
index 51d8c3c..d2d711c 100755
--- a/custom/hooks/post-receive.commit-graph
+++ b/custom/hooks/post-receive.commit-graph
@@ -10,7 +10,7 @@
# --split writes each push's new commits as a small layer over the last, and
# git merges the layers as they pile up, so a push costs little. A git too old
# for these options leaves the graph as it was, and nothing here complains or
-# exits nonzero, so the pusher is not shown an error over a missing speedup.
+# exits non-zero, so the pusher is not shown an error over a missing speedup.
#
# To install the hook, copy or link it to hooks/post-receive in each
# repository. Git runs one post-receive per repository, so fold this together