1# Only a repo's owner changes its collaborators. Collaborators see the list2# but can't change it; a reader can't see it (who shows them everyone).3# The name must be a user and not the owner; adding twice adds once; rm of4# someone not on it says so. The operator's forge collaborators does the5# same for any repo.6. "$(dirname "$0")/../lib.sh"7user dami8user ana9user bob10user fox11repo --private dami/secret12ok ssh_as dami collaborators dami/secret add ana13ok ssh_as dami readers dami/secret add bob1415fails_with "only dami can change who collaborates on dami/secret" ssh_as ana collaborators dami/secret add fox16fails_with "only dami can change who collaborates on dami/secret" ssh_as ana collaborators dami/secret rm ana17ok ssh_as ana collaborators dami/secret18eq "$(output)" ana19fails_with "only dami and collaborators of dami/secret" ssh_as bob collaborators dami/secret20fails_with "^forge: no repo dami/secret$" ssh_as fox collaborators dami/secret add fox2122ok ssh_as dami collaborators dami/secret add ana23eq "$(output)" "ana already collaborates on dami/secret"24eq "$(grep -c . "$FORGE_ROOT/dami/secret.git/forge/collaborators")" 125fails_with "no user nobody" ssh_as dami collaborators dami/secret add nobody26fails_with "no user \\.\\./x" ssh_as dami collaborators dami/secret add ../x27fails_with "dami owns dami/secret" ssh_as dami collaborators dami/secret add dami28fails_with "fox is not a collaborator of dami/secret" ssh_as dami collaborators dami/secret rm fox29fails_with "usage: collaborators" ssh_as dami collaborators dami/secret drop ana30fails_with "usage: collaborators" ssh_as dami collaborators dami/secret add3132ok forge collaborators dami/secret add fox33has "$T_LOG" '^fox collaborates on dami/secret'34ok forge collaborators dami/secret35eq "$(output)" "ana36fox"37fails_with "no repo dami/nope" forge collaborators dami/nope add fox3839ok ssh_as dami help40has "$T_LOG" '^ collaborators <owner>/<repo> \[add\|rm <user>\] '41has "$T_LOG" '^ who <owner>/<repo> '42exists "$FORGE_ROOT/git-shell-commands/collaborators"43exists "$FORGE_ROOT/git-shell-commands/who"