From 4c5bb27739f4311cd3b7a5acb38b20642e3147e7 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Wed, 11 Apr 2012 18:24:43 +0530 Subject: [PATCH] pre-existing repo instructions were WRONG... - fix them - but (at the cost of some efficiency) try to compensate if the admin did not follow those instructions, by running hook_1 anyway --- doc/admin.mkd | 2 +- doc/rare.mkd | 19 +++++++++++++++---- doc/repos.mkd | 5 ++++- src/lib/Gitolite/Conf/Store.pm | 3 +++ 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/doc/admin.mkd b/doc/admin.mkd index 60f6370..0dc21aa 100644 --- a/doc/admin.mkd +++ b/doc/admin.mkd @@ -6,7 +6,7 @@ The following activities require command line access to the server * changing anything in the [rc][] file * installing custom [hooks][], whether to all repos or just some repos - * moving [existing][] (bare) repos into gitolite control + * moving [existing][] repos into gitolite control Please read the [WARNINGS][] page first. diff --git a/doc/rare.mkd b/doc/rare.mkd index 9e7be4e..e1fca65 100644 --- a/doc/rare.mkd +++ b/doc/rare.mkd @@ -2,8 +2,21 @@ ## #existing moving existing repos into gitolite - * move the repos to `$HOME/repositories`. Make sure they are all *bare* - repos, and the directory names end in ".git". +On the server: + + * move the repos to `$HOME/repositories`. + + * make sure that: + + * they are all *bare* repos + * all the repo names end in ".git" + * all the files and directories are owned and writable by the gitolite + hosting user (especially true if you copied them as root) + + * run `gitolite setup`. **If you forget this step, you can also forget + about write access control!** + +Back on your workstation: * [add them][repos] to conf/gitolite.conf in your clone of the admin repo, then commit and push the change. @@ -11,8 +24,6 @@ If the repos are already covered by some [wild][] pattern, this is optional. - * run `gitolite setup` to fix up the hooks on all repos, just in case. - ## #moving moving servers This is adapted from the "migrating" section of the [install][] page; if diff --git a/doc/repos.mkd b/doc/repos.mkd index 624125e..9edd44b 100644 --- a/doc/repos.mkd +++ b/doc/repos.mkd @@ -1,8 +1,11 @@ # adding and removing repos +**NOTE**: this page describes how to add new repos. To bring already existing +repos into gitolite control, click [here][existing]. + > ---- -> *WARNING: Do NOT add repos directly on the server. Clone the +> *WARNING: Do NOT add new repos directly on the server. Clone the > 'gitolite-admin' repo to your workstation, make changes to it, then add, > commit, and push. When the push hits the server, the server "acts" upon > your changes.* diff --git a/src/lib/Gitolite/Conf/Store.pm b/src/lib/Gitolite/Conf/Store.pm index a568a3b..ef5b0fd 100644 --- a/src/lib/Gitolite/Conf/Store.pm +++ b/src/lib/Gitolite/Conf/Store.pm @@ -161,6 +161,9 @@ sub new_repos { next unless $repo =~ $REPONAME_PATT; # skip repo patterns next if $repo =~ m(^\@|EXTCMD/); # skip groups and fake repos + # use gl-conf as a sentinel + hook_1($repo) if -d "$repo.git" and not -f "$repo.git/gl-conf"; + new_repo($repo) if not -d "$repo.git"; } }