aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSitaram Chamarty <sitaram@sita-lt.atc.tcs.com>2009-10-03 13:17:02 +0530
committerSitaram Chamarty <sitaram@sita-lt.atc.tcs.com>2009-10-04 10:10:40 +0530
commit2f2af033f53954e919ca0b9fae94e521fbaf47ba (patch)
treefcbc4350984d8a9340da4b1eef68350965213c0d
parentp-t-a: make the post-update hook a separate file... (diff)
downloadgitolite-gentoo-2f2af033f53954e919ca0b9fae94e521fbaf47ba.tar.gz
gitolite-gentoo-2f2af033f53954e919ca0b9fae94e521fbaf47ba.tar.bz2
gitolite-gentoo-2f2af033f53954e919ca0b9fae94e521fbaf47ba.zip
pta-hook.sh: collect delegated config fragments
collect the delegated config fragments from correspondingly named branches of the gitolite-admin repo, and put them all in conf/fragments/ also deprecate changes to conf and keydir locations from now on
-rw-r--r--conf/example.gitolite.rc8
-rwxr-xr-xsrc/pta-hook.sh27
2 files changed, 31 insertions, 4 deletions
diff --git a/conf/example.gitolite.rc b/conf/example.gitolite.rc
index 3725110..ea80bec 100644
--- a/conf/example.gitolite.rc
+++ b/conf/example.gitolite.rc
@@ -57,8 +57,12 @@ $GL_LOGT="$GL_ADMINDIR/logs/gitolite-%y-%m.log";
# --------------------------------------
-# I see even less reason to change these, since they're all relative to the
-# gitolite admin directory above, but hey it's *your* system...
+# Please DO NOT change the following paths unless you really know what you're
+# doing. It'll work for now but it's officially deprecated to have them
+# elsewhere from now on, and may break some future features.
+
+# Anyway, the conf files and keydirs don't grow constantly, (like the logs and
+# the repositories do), so I don't think this is a major problem for anyone.
$GL_CONF="$GL_ADMINDIR/conf/gitolite.conf";
$GL_KEYDIR="$GL_ADMINDIR/keydir";
diff --git a/src/pta-hook.sh b/src/pta-hook.sh
index 283cc9f..cbc0d2f 100755
--- a/src/pta-hook.sh
+++ b/src/pta-hook.sh
@@ -1,6 +1,29 @@
#!/bin/sh
-GIT_WORK_TREE=/home/git/.gitolite git checkout -f
+# get this from your .gitolite.conf; and don't forget this is shell, while
+# that is perl :-)
+export GL_ADMINDIR=/home/git/.gitolite
-cd /home/git/.gitolite
+# checkout the master branch to $GL_ADMINDIR
+GIT_WORK_TREE=$GL_ADMINDIR git checkout -f master
+
+# collect all the delegated fragments
+mkdir -p $GL_ADMINDIR/conf/fragments
+for br in $(git for-each-ref --format='%(refname:short)')
+do
+ # skip master (duh!)
+ [[ $br == master ]] && continue
+ # all other branches *should* contain a file called <branchname>.conf
+ # inside conf/fragments; if so copy it
+ if git show $br:conf/fragments/$br.conf > /dev/null 2>&1
+ then
+ git show $br:conf/fragments/$br.conf > $GL_ADMINDIR/conf/fragments/$br.conf
+ echo "(extracted $br conf; `wc -l < $GL_ADMINDIR/conf/fragments/$br.conf` lines)"
+ else
+ echo " ***** ERROR *****"
+ echo " branch $br does not contain conf/fragments/$br.conf"
+ fi
+done
+
+cd $GL_ADMINDIR
src/gl-compile-conf