From bd29033a1ba325850f6fa29112eee58345fb9da6 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 06:31:18 -1000 Subject: Keep the cache hook's rm errors from pushers Only the exit status was hidden, so a pusher without write access to the cache root saw a permission error per cached page, against what the hook's own comment promised. --- custom/hooks/post-receive.cgit-cache | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'custom/hooks/post-receive.cgit-cache') diff --git a/custom/hooks/post-receive.cgit-cache b/custom/hooks/post-receive.cgit-cache index 148a3f3..b1d5c13 100755 --- a/custom/hooks/post-receive.cgit-cache +++ b/custom/hooks/post-receive.cgit-cache @@ -12,9 +12,9 @@ # # 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 exits nonzero when -# that access is missing, so the pusher is not shown an error over a stale -# page. +# 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 +# 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 @@ -30,4 +30,4 @@ test -d "$cache_root" || exit 0 # worth keeping is the lock files, which belong to writers still working. # The "! -name . -prune" pair is how POSIX find stays out of subdirectories. find "$cache_root"/. ! -name . -prune ! -name '*.lock' -type f \ - -exec rm -f {} + || exit 0 + -exec rm -f {} + 2>/dev/null || exit 0 -- cgit