clone

a personal forge on plain git: static pages, stacked-diff reviews, signed local ci, repo sites and releases

main
forge / test / scenarios / private-pages.sh
private-pages.sh 2.2K
1# A private repo's pages are built into the private root, with the same2# layout as www (pages, search index, code index), and nowhere in www: no3# pages, no entry on the index, owner pages or repos.json. They link the4# same hashed assets, which are in www/assets. Nothing else of the private5# build (its index or owner pages) lands anywhere, and a full build drops6# private pages of repos that are public or gone.7. "$(dirname "$0")/../lib.sh"8user dami9repo --private dami/secret "hidden thing"10repo dami/open "open thing"11for r in secret open; do12 clone dami "dami/$r" "$T/w/$r"13 at "$T/w/$r" commit "first"14 ok push_as dami "$T/w/$r" origin main15done16# Left over from before: private pages of a repo that is public now, and of17# one that is gone. A full build drops them.18p=$FORGE_ROOT/.forge/private/www19mkdir -p "$p/dami/open" "$p/gone/repo"20build21missing "$p/dami/open"22missing "$p/gone"23missing "$FORGE_WWW/dami/secret"24exists "$FORGE_WWW/dami/open/index.html"25for f in index.html dami/index.html repos.json; do26 lacks "$FORGE_WWW/$f" 'dami/secret|hidden thing'27 has "$FORGE_WWW/$f" 'dami/open'28done29if grep -rlq 'hidden thing' "$FORGE_WWW"; then fail "the private repo's description is in www"; fi3031for f in index.html search.json code.db reviews.json "log/main/index.html"; do exists "$p/dami/secret/$f"; done32has "$p/dami/secret/index.html" 'hidden thing'33has "$p/dami/secret/index.html" 'class="private-mark" href="/private/"'34has "$p/dami/secret/index.html" 'HTTPS takes a token: <code>ssh git@forge.test token --repo dami/secret</code>'35lacks "$FORGE_WWW/dami/open/index.html" 'private-mark'36eq "$(ls "$p")" dami37eq "$(ls "$p/dami")" secret38eq "$(mode "$FORGE_ROOT/.forge/private")" 70039for a in $(grep -rhoE '(href|src)="/assets/[^"]+"' "$p" --include=index.html | sed -E 's/^[a-z]+="//; s/"$//' | sort -u); do40 exists "$FORGE_WWW$a"41done4243build dami/secret44has "$T_LOG" 'built dami/secret \(private\)'45missing "$FORGE_WWW/dami/secret"46# Its commit-graph is kept up for git too.47exists "$FORGE_ROOT/dami/secret.git/objects/info/commit-graphs/commit-graph-chain"4849# A push rebuilds it there, like any repo's pages.50sync_builds51at "$T/w/secret" commit "second"52ok push_as dami "$T/w/secret" origin main53has "$p/dami/secret/index.html" 'second'54missing "$FORGE_WWW/dami/secret"