2010-06-01 12:57:33 +02:00
|
|
|
#!/bin/sh
|
2010-04-24 19:30:38 +02:00
|
|
|
|
|
|
|
. $(dirname $0)/adc.common-functions
|
|
|
|
|
2011-01-15 16:39:56 +01:00
|
|
|
[ -z "$GL_RC" ] && die "ENV GL_RC not set"
|
|
|
|
|
2010-10-27 19:38:58 +02:00
|
|
|
# get_rights_and_owner now also sets $repo; see comments in common functions
|
|
|
|
get_rights_and_owner $1; from=$repo
|
2010-06-01 12:57:33 +02:00
|
|
|
[ -z "$perm_read" ] && die "no read permissions on $from"
|
2010-04-24 19:30:38 +02:00
|
|
|
|
2010-10-27 19:38:58 +02:00
|
|
|
get_rights_and_owner $2; to=$repo
|
2010-06-01 12:57:33 +02:00
|
|
|
[ -z "$perm_create" ] && die "no create permissions on $to"
|
2010-04-24 19:30:38 +02:00
|
|
|
|
2010-06-12 12:32:07 +02:00
|
|
|
# clone $from to $to
|
|
|
|
git clone --bare -l $GL_REPO_BASE_ABS/$from.git $GL_REPO_BASE_ABS/$to.git
|
2010-06-22 13:30:48 +02:00
|
|
|
[ $? -ne 0 ] && exit 1
|
2010-06-12 12:32:07 +02:00
|
|
|
|
2010-08-20 17:25:23 +02:00
|
|
|
# fix up creator, gitweb owner, and hooks
|
2010-04-24 19:30:38 +02:00
|
|
|
cd $GL_REPO_BASE_ABS/$to.git
|
2010-06-12 12:32:07 +02:00
|
|
|
echo $GL_USER > gl-creater
|
2010-08-20 17:25:23 +02:00
|
|
|
git config gitweb.owner "$GL_USER"
|
2011-01-15 16:39:56 +01:00
|
|
|
( $GL_BINDIR/gl-query-rc GL_WILDREPOS_DEFPERMS ) |
|
2010-08-20 17:25:23 +02:00
|
|
|
SSH_ORIGINAL_COMMAND="setperms $to" $GL_BINDIR/gl-auth-command $GL_USER
|
2010-06-12 12:32:07 +02:00
|
|
|
cp -R $GL_REPO_BASE_ABS/$from.git/hooks/* $GL_REPO_BASE_ABS/$to.git/hooks
|
2010-06-22 13:30:48 +02:00
|
|
|
|
|
|
|
if [ -n "$GL_WILDREPOS_DEFPERMS" ]; then
|
|
|
|
echo "$GL_WILDREPOS_DEFPERMS" > gl-perms
|
|
|
|
fi
|
|
|
|
|
2010-09-24 12:49:33 +02:00
|
|
|
# run gitolite's post-init hook if you can (hook code expects GL_REPO to be set)
|
|
|
|
export GL_REPO; GL_REPO="$to"
|
|
|
|
[ -x hooks/gl-post-init ] && hooks/gl-post-init
|