git_infra

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

commit 34de30843820ccaa24c91729e71d87deba923aa7
parent 8351260863940a12e3b58dd0b81cef17573b4fa2
Author: Chris Bracken <chris@bracken.jp>
Date:   Tue,  7 Jun 2022 18:37:20 -0700

grm: skip recompiling pages for private repos

Previously the grm recompile all (rca) command only recompiled public
repos, but the recompile (rc) command compiled pages for any repo,
including private repos.

We now update the recompile (rc) command to skip private repos, and the
recompile all (rca) command to run over all repos. This will rebuild
public and unlisted repos, but not private repos.

Diffstat:
Mgrm | 30+++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/grm b/grm @@ -33,23 +33,27 @@ repos_root=${GRM_REPOS_ROOT:-/home/git} web_root=${STAGIT_WEB_ROOT:-/srv/git} recompile_repo() { - echo "[$1] recompiling stagit pages..." repo_dir="${repos_root}/${1}.git" repo_web_dir="${web_root}/${repo_name}" cachefile="${repo_dir}/.htmlcache" [ -d "$repo_dir" ] || { echo "[$1] repo not found"; return 1; } - mkdir -p "$repo_web_dir" - - cd "${repo_web_dir:?}" && \ - rm -f "$cachefile" && \ - rm -rf "commit" "file" && \ - stagit -c "$cachefile" "$repo_dir" && \ - ln -sf log.html index.html && \ - ln -sf ../logo.png logo.png && \ - ln -sf ../style.css style.css && \ - ln -sf ../favicon.png favicon.png && \ - echo "[$1] done!" + + if [ -e "$repo_dir/git-daemon-export-ok" ]; then + echo "[$1] recompiling stagit pages..." + mkdir -p "$repo_web_dir" + cd "${repo_web_dir:?}" && \ + rm -f "$cachefile" && \ + rm -rf "commit" "file" && \ + stagit -c "$cachefile" "$repo_dir" && \ + ln -sf log.html index.html && \ + ln -sf ../logo.png logo.png && \ + ln -sf ../style.css style.css && \ + ln -sf ../favicon.png favicon.png && \ + echo "[$1] done!" + else + echo "[$1] Not recompiling stagit pages: private repo" + fi } rebuild_index() { @@ -198,7 +202,7 @@ grm_recompile() { } grm_recompileall() { - grm_list public \ + grm_list \ | sed -e 's/"/"\\""/g' -e 's/.*/"&"/' \ | xargs "$0" rc }