create command: remove race condition...
[gitolite.git] / src / commands / create
blobd35c4a83971808d2ee53f60e792b820e070dd555
1 #!/bin/sh
3 # Usage: ssh git@host create <repo>
5 # Create wild repo.
7 die() { echo "$@" >&2; exit 1; }
8 usage() { perl -lne 'print substr($_, 2) if /^# Usage/../^$/' < $0; exit 1; }
9 [ -z "$1" ] && usage
10 [ -z "$2" ] || usage
11 [ "$1" = "-h" ] && usage
12 [ -z "$GL_USER" ] && die GL_USER not set
14 # ----------------------------------------------------------------------
15 perms=$(gitolite git-config -r $1 gitolite-options.default.roles | sort | cut -f3 |
16 perl -pe 's/(\s)CREATOR(\s|$)/$1$ENV{GL_USER}$1/')
17 echo "$perms" | $GL_BINDIR/commands/perms -c "$@"