summaryrefslogtreecommitdiff
path: root/git.liw.fi.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git.liw.fi.sh')
-rw-r--r--git.liw.fi.sh59
1 files changed, 20 insertions, 39 deletions
diff --git a/git.liw.fi.sh b/git.liw.fi.sh
index 6f1163c..f4245f1 100644
--- a/git.liw.fi.sh
+++ b/git.liw.fi.sh
@@ -1,14 +1,7 @@
-gitano()
-{
- local keyname="$1"
- shift
- if [ "$keyname" = "liw" ]
- then
- ssh "$GITANO" "$@"
- else
- SSH_AUTH_SOCK= ssh -F "ssh.conf" -i "$keyname.key" "$GITANO" "$@"
- fi
-}
+# Shell library for running git.liw.fi ACL tests.
+
+
+# This is handy for giving an error message and aborting.
die()
{
@@ -16,40 +9,28 @@ die()
exit 1
}
-attempt()
-{
- if "$@" > "$DATADIR/attempt.stdout" 2> "$DATADIR/attempt.stderr"
- then
- echo 0 > "$DATADIR/attempt.exit"
- else
- echo $? > "$DATADIR/attempt.exit"
- fi
-}
-clone_using_git()
+# Run gitano on the server using a desired ssh key. The key is
+# either the admin key (i.e., they key of whoever invoked the
+# test suite), or a test key we've created in $DATADIR.
+
+run_gitano_as()
{
- local dir="$1/$2"
- local url="git://$GITHOST/$2"
- rm -rf "$dir"
- mkdir -p "$dir"
- if [ "$1" = liw ]
+ local keyname="$1"
+ shift
+ if [ "$keyname" = "admin" ]
then
- git clone "$url" "$dir"
+ ssh "$GITANO@$GITHOST" "$@"
else
- SSH_AUTH_SOCK= git clone "$url" "$dir"
+ SSH_AUTH_SOCK= ssh -F "ssh.conf" -i "$DATADIR/$keyname.key" \
+ "$GITANO@GITHOST" "$@"
fi
}
-clone_using_ssh()
+
+# Does a user exist on the server?
+
+user_exists()
{
- local dir="$1/$2"
- local url="ssh://$GITANO/$2"
- rm -rf "$dir"
- mkdir -p "$dir"
- if [ "$1" = liw ]
- then
- git clone "$url" "$dir"
- else
- PATH="$SRCDIR:$PATH" git clone "$url" "$dir"
- fi
+ ssh "$GITANO@$GITHOST" user | grep "^$1:"
}