git_infra

Git infra scripts for git.bracken.jp
git clone https://git.bracken.jp/git_infra.git
Log | Files | Refs | LICENSE

commit 7131cf3b8e2e2de786c03e76b5a7d407ee9e91d0
parent c83faa3a6783f25b37abb63c005c5323d474eb31
Author: Chris Bracken <chris@bracken.jp>
Date:   Sun, 16 Aug 2026 08:11:52 +0900

Correct output pages cleanup on force push

Diffstat:
Mpost-receive.d/gout | 12+++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/post-receive.d/gout b/post-receive.d/gout @@ -5,8 +5,8 @@ export LC_CTYPE="en_US.UTF-8" # Add Mastodon verification URL to index header. me_url="https://famichiki.jp/@akande" -# HTML root directory into which gout will write. -www_root="/usr/local/www/git.bracken.jp" +# root directory into which gout will write pages. +www_root="/var/www/git.bracken.jp" # Hooks are called from the repo directory. repo_dir=$(pwd) @@ -25,6 +25,9 @@ repos_root=$(dirname "$repo_dir") # The user-friendly name of the repository. repo_name=$(basename "$repo_dir" '.git') +# Directory into which repo pages will be written. +repo_web_dir="${www_root}/${repo_name}" + # Detect --force pushes. cd "${repo_dir}" || exit 1 force=0 @@ -47,13 +50,12 @@ done # file will trigger a full rebuild below. if [ "$force" = "1" ]; then rm -f "$cachefile" - rm -rf "commit" "file" + rm -rf "${repo_web_dir}/commit" "${repo_web_dir}/file" fi # Build the pages. If $cachefile is not present, a full rebuild is performed. if [ -e "${repo_dir}/git-daemon-export-ok" ]; then - # Change to the directory where we will output HTML pages. - repo_web_dir="${www_root}/${repo_name}" + # Change to the directory where we will output pages. mkdir -p "$repo_web_dir" cd "$repo_web_dir" || exit 1