1# The approval rules where people meet them: a review page's "to land"2# panel says what landing needs and has, and forge land checks the same3# verdict before it pushes (the forge's gate still decides).4. "$(dirname "$0")/../lib.sh"5user dami6user ana7repo dami/greet8G=$FORGE_ROOT/dami/greet.git9clone dami dami/greet "$T/w/seed"10mkdir -p "$T/w/seed/.forge"11printf '.forge/ 2\n*.md none\n* 1\n' >"$T/w/seed/.forge/approvals"12printf '#!/bin/sh\ntrue\n' >"$T/w/seed/.forge/ci"13chmod +x "$T/w/seed/.forge/ci"14at "$T/w/seed" commit "first, and the rules" a.txt15ok push_as dami "$T/w/seed" origin main16git --git-dir="$G" config forge.requireapproval true1718clone_ssh dami dami/greet "$T/w/d"19cl() { (cd "$T/w/d" && FORGE_USER=dami GIT_SSH_COMMAND="$T/ssh" "$FORGE" "$@"); }20at "$T/w/d" git switch -q -c dami/two21echo x >"$T/w/d/a.txt"22echo x >"$T/w/d/notes.md"23at "$T/w/d" git add -A24at "$T/w/d" git commit -q -m "change a and the notes"25ok cl attest26ok cl push27build dami/greet28page=$FORGE_WWW/dami/greet/reviews/1/index.html29has "$page" '<b>to land</b><span class="grow">on <span class="mono">main</span>, which the forge holds to these</span>'30has "$page" '<a href="/dami/greet/blob/main/.forge/approvals/#l3">1 approval</a> <span class="paths">for <span class="mono">a.txt</span></span><span class="has">: not approved yet</span>'31# notes.md is under "none": it needs nothing, so it isn't listed.32lacks "$page" 'class="mono">notes.md'33fails_with "land: #1 isn't approved enough to land on main" cl land 134has "$T_LOG" 'NEED 1 approval \(\.forge/approvals:3\) for a\.txt: no approvals'35ok ssh_as ana approve dami/greet 136build dami/greet37has "$page" '<span class="ci pass">✓</span></td><td class="main"><a href="/dami/greet/blob/main/.forge/approvals/#l3">1 approval</a>.*<span class="has">: approved by ana</span>'38ok cl land 139has "$T_LOG" 'ok 1 approval \(\.forge/approvals:3\) for a\.txt: approved by ana'40has "$T_LOG" 'landed #1 on main'4142# Without forge.requireapproval the panel says approval is optional.43git --git-dir="$G" config forge.requireapproval false44at "$T/w/d" git switch -q -c dami/three origin/main45echo y >"$T/w/d/a.txt"46at "$T/w/d" git commit -q -am "again"47ok push_as dami "$T/w/d" origin dami/three48build dami/greet49has "$FORGE_WWW/dami/greet/reviews/2/index.html" '; approval is optional here</span>'