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.sh28
1 files changed, 16 insertions, 12 deletions
diff --git a/git.liw.fi.sh b/git.liw.fi.sh
index 1c52c2e..9f03ff3 100644
--- a/git.liw.fi.sh
+++ b/git.liw.fi.sh
@@ -66,14 +66,17 @@ user_add()
}
-# Remove a user from the server. This is a two-step process.
+# A helper function to do a two-step destruction on gitano. With the
+# first step, gitano outputs a token, which is the last word on the
+# last line of the output. The second step has the same command line
+# as the first step, but with the token appended.
-user_del()
+two_step()
{
- if run_gitano_as "$1" user del "$2" 2> "$DATADIR/temp"
+ if "$@" 2> "$DATADIR/temp"
then
secret=$(awk '{ s = $2 } END { print s }' "$DATADIR/temp")
- run_gitano_as "$1" user del "$2" "$secret"
+ "$@" "$secret"
else
cat "$DATADIR/temp" 1>&2
return 1
@@ -81,6 +84,14 @@ user_del()
}
+# Remove a user from the server. This is a two-step process.
+
+user_del()
+{
+ two_step run_gitano_as "$1" user del "$2"
+}
+
+
# Does a repository exist?
repo_exists()
@@ -111,12 +122,5 @@ clone_with_ssh()
destroy_repo()
{
- if run_gitano_as "$1" destroy "$2" 2> "$DATADIR/temp"
- then
- secret=$(awk '{ s = $2 } END { print s }' "$DATADIR/temp")
- run_gitano_as "$1" destroy "$2" "$secret"
- else
- cat "$DATADIR/temp" 1>&2
- return 1
- fi
+ two_step run_gitano_as "$1" destroy "$2"
}