From 517786572d89e8e1e8bdf4ed13d834c47700ef30 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Sat, 12 Jun 2010 16:02:07 +0530 Subject: [PATCH] (adc fork) fork is now fast and space-efficient on the server uses "git clone -l" then manually sets up the gl-creater and hooks (thanks to Jeff and the kde gang for asking ;-) --- contrib/adc/fork | 14 ++++++-------- doc/admin-defined-commands.mkd | 9 --------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/contrib/adc/fork b/contrib/adc/fork index d5b065a..b61f415 100755 --- a/contrib/adc/fork +++ b/contrib/adc/fork @@ -5,18 +5,16 @@ to=$2 . $(dirname $0)/adc.common-functions -# we cannot just say "cd $GL_REPO_BASE_ABS; git clone $from.git $to.git". That -# won't set up the hooks or the gl-creater file that gitolite needs. So we now -# have a new "git-init" command! - get_rights_and_owner $from [ -z "$perm_read" ] && die "no read permissions on $from" get_rights_and_owner $to [ -z "$perm_create" ] && die "no create permissions on $to" -# let gitolite create the repo first -SSH_ORIGINAL_COMMAND="git-init '$to'" $GL_BINDIR/gl-auth-command $GL_USER -# then copy the refs from $from +# clone $from to $to +git clone --bare -l $GL_REPO_BASE_ABS/$from.git $GL_REPO_BASE_ABS/$to.git + +# fix up creator, and hooks cd $GL_REPO_BASE_ABS/$to.git -git fetch $GL_REPO_BASE_ABS/$from.git refs/*:refs/* +echo $GL_USER > gl-creater +cp -R $GL_REPO_BASE_ABS/$from.git/hooks/* $GL_REPO_BASE_ABS/$to.git/hooks diff --git a/doc/admin-defined-commands.mkd b/doc/admin-defined-commands.mkd index 7db971d..61e4b6a 100644 --- a/doc/admin-defined-commands.mkd +++ b/doc/admin-defined-commands.mkd @@ -167,15 +167,6 @@ the client side: or some such incantation. -**Implementation note**: you might notice that this script does not just do a -"git clone ...". This is because creating a repo has to be done via gitolite. -Otherwise, hooks won't get setup, and the all-important "gl-creater" file -showing who owns the repo won't get created. - -So now we have an actual command to just create a repo and do nothing else: -`ssh git@server git-init \'reponame\'`. [Yes; those single quotes are -required. Deal with it.] - #### rmrepo