1# collaborators add lets a user push main, which only the owner could;2# rm takes it back, and they push branches under their own name again,3# like anyone else.4. "$(dirname "$0")/../lib.sh"5user dami6user fox7repo dami/greet8clone dami dami/greet "$T/w/dami"9at "$T/w/dami" commit "first"10ok push_as dami "$T/w/dami" origin main11clone fox dami/greet "$T/w/fox"1213at "$T/w/fox" commit "from fox"14fails_with "only dami can push main" push_as fox "$T/w/fox" origin main15ok ssh_as dami collaborators dami/greet add fox16has "$T_LOG" '^fox collaborates on dami/greet: they can push anything to it'17eq "$(cat "$FORGE_ROOT/dami/greet.git/forge/collaborators")" fox18ok push_as fox "$T/w/fox" origin main19eq "$(git --git-dir="$FORGE_ROOT/dami/greet.git" log -1 --format=%s main)" "from fox"2021ok ssh_as dami collaborators dami/greet rm fox22has "$T_LOG" '^fox no longer collaborates on dami/greet'23eq "$(cat "$FORGE_ROOT/dami/greet.git/forge/collaborators")" ""24at "$T/w/fox" commit "again"25fails_with "only dami can push main" push_as fox "$T/w/fox" origin main26ok push_as fox "$T/w/fox" origin HEAD:fox/again