commit 8351260863940a12e3b58dd0b81cef17573b4fa2
parent 1530403e7f9d6d4cf26fe9b9b3400ac93b7c3857
Author: Chris Bracken <chris@bracken.jp>
Date: Tue, 7 Jun 2022 17:06:34 -0700
Build pages for unlisted repos
We now regenerate static HTML pages for all repos with a
git-daemon-export-ok file. Previously we did NOT generate static pages
if a stagit-no-index file was present. These repos are however, NOT
added to the repo index page.
This also changes the behaviour of 'grm list unlisted' to show those
repos with both git-daemon-export-ok and stagit-no-index set.
Behaviour is now:
public:
* git-daemon-export-ok is created
* stagit-no-index is NOT created
* HTTPS clone: yes
* Has repo pages: yes
* Listed in repo index: yes
unlisted:
* git-daemon-export-ok is created
* stagit-no-index is created
* HTTPS clone: yes
* Has repo pages: yes
* Listed in repo index: no
private:
* git-daemon-export-ok is NOT created
* stagit-no-index is created
* HTTPS clone: no
* Has repo pages: no
* Listed in repo index: no
Diffstat:
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/grm b/grm
@@ -177,6 +177,7 @@ grm_list() {
hidden|unlisted)
find "${repos_root}/." ! -name . -prune \
-type d -name "*.git" \
+ -exec test -e "{}/git-daemon-export-ok" \; \
-exec test -e "{}/stagit-no-index" \; \
-exec basename {} '.git' \; | sort -f ;;
*)
diff --git a/post-receive.d/stagit b/post-receive.d/stagit
@@ -42,14 +42,14 @@ if [ "$force" = "1" ]; then
fi
# Build the pages. If $cachefile is not present, a full rebuild is performed.
-if [ ! -e "${repo_dir}/stagit-no-index" ]; then
+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}"
mkdir -p "$repo_web_dir"
cd "$repo_web_dir" || exit 1
# Generate the index page.
- # Any repo containing a stagit-no-index file will be skipped.
+ # Any repo containing a stagit-no-index file will not be indexed.
echo "[stagit] Building repo index"
find "${repos_root}/." -maxdepth 1 \
-type d \
@@ -62,6 +62,7 @@ if [ ! -e "${repo_dir}/stagit-no-index" ]; then
| xargs stagit-index \
> "${www_root}/index.html"
+ # Rebuild the pages for the repo (including for unlisted repos).
echo "[stagit] Building pages"
stagit -c "$cachefile" "$repo_dir"
@@ -72,5 +73,5 @@ if [ ! -e "${repo_dir}/stagit-no-index" ]; then
ln -sf ../logo.png logo.png
ln -sf ../favicon.png favicon.png
else
- echo "[stagit] Not building pages: private/unlisted repo"
+ echo "[stagit] Not building pages: private repo"
fi