At sftp://[email protected]/srv/bzr/administration/
------------------------------------------------------------ revno: 242 revision-id: [email protected] parent: [email protected] committer: root <[email protected]> branch nick: infra timestamp: Sun 2010-08-01 06:26:16 -0400 message: Working CIA hook setup for Git modified: git.txt x_root_<[email protected]>_Sun_Jun__4_15:56:39_2006_25310.0 === modified file 'git.txt' --- a/git.txt 2010-08-01 00:30:41 +0000 +++ b/git.txt 2010-08-01 10:26:16 +0000 @@ -147,19 +147,19 @@ cd /srv/git umask 002 project=XXX -dir_git=${project}.git +export GIT_DIR=${project}.git # --shared sets g+s on directories -GIT_DIR=$dir_git git init --shared=all -chgrp -R $project $dir_git +git init --shared=all +chgrp -R $project $GIT_DIR # needed to make the repo accessible via bare HTTP -cat << EOF > $dir_git/hooks/post-update +cat << EOF > $GIT_DIR/hooks/post-update #!/bin/sh exec git update-server-info EOF -chmod 755 $dir_git/hooks/post-update +chmod 755 $GIT_DIR/hooks/post-update # forbid access to hooks -chown -R root: $dir_git/hooks -chattr +i $dir_git/hooks +chown -R root: $GIT_DIR/hooks +chattr +i $GIT_DIR/hooks mkdir -m 2755 $project/ chown root:$project $project/ @@ -176,17 +176,17 @@ # Per-project setup pushd /srv/git project=myproject -cat <<'EOF' > $dir_git/hooks/post-receive +cat <<'EOF' > $GIT_DIR/hooks/post-receive #!/bin/bash exec run-parts hooks/post-receive.d EOF -chmod 755 $dir_git/hooks/post-receive -chattr -i $dir_git/hooks -mkdir -m 755 $dir_git/hooks/post-receive.d -chattr +i $dir_git/hooks -ln -s /usr/src/git/contrib/hooks/post-receive-email $dir_git/hooks/post-receive.d/ -GIT_DIR=$dir_git git config hooks.showrev "t=%s; echo http://git.savannah.gnu.org/cgit/${dir_git}/commit/?id=\$t; echo; echo; git show -C \$t; echo" -GIT_DIR=$dir_git git config hooks.mailinglist [email protected] +chmod 755 $GIT_DIR/hooks/post-receive +chattr -i $GIT_DIR/hooks +mkdir -m 755 $GIT_DIR/hooks/post-receive.d +chattr +i $GIT_DIR/hooks +ln -s /usr/src/git/contrib/hooks/post-receive-email $GIT_DIR/hooks/post-receive.d/ +git config hooks.showrev "t=%s; echo http://git.savannah.gnu.org/cgit/${dir_git}/commit/?id=\$t; echo; echo; git show -C \$t; echo" +git config hooks.mailinglist [email protected] popd # Repository maintenance: @@ -250,20 +250,28 @@ cd /srv/git umask 002 project=XXX -dir_git=${project}.git - -cat <<'EOF' > $dir_git/hooks/post-commit -#!/bin/bash -exec run-parts hooks/post-commit.d -EOF -chmod 755 $dir_git/hooks/post-commit -chattr -i $dir_git/hooks -mkdir -m 755 $dir_git/hooks/post-commit.d -chattr +i $dir_git/hooks - -GIT_DIR=$dir_git git config ciabot.xmlrpc true -GIT_DIR=$dir_git git config ciabot.project $project -GIT_DIR=$dir_git git config ciabot.repo $project.git -ln -s /usr/src/git/contrib/ciabot/ciabot.py $dir_git/hooks/post-commit.d/ciabot -# Not sure post-commit will manage properly multi-commits uploads. -# Maybe test with the 'update' hook instead +export GIT_DIR=${project}.git + +cat <<'EOF' > $GIT_DIR/hooks/update +#!/bin/bash +exec run-parts hooks/update.d +EOF +chmod 755 $GIT_DIR/hooks/update +chattr -i $GIT_DIR/hooks +mkdir -m 755 $GIT_DIR/hooks/update.d +chattr +i $GIT_DIR/hooks + +git config ciabot.xmlrpc true +git config ciabot.project $project +git config ciabot.repo $project.git +# Can't call ciabot directly - need a wrapper for 'update' >( +# For reference, using the 'commit' hook would only work for a local +# repository. +cat <<'EOF' > $GIT_DIR/hooks/update.d/ciabot +#!/bin/bash +refname=$1 +oldhead=$2 +newhead=$3 +exec /usr/src/git/contrib/ciabot/ciabot.py ${refname} $(git rev-list ${oldhead}..${newhead} | tac) +EOF +chmod 755 $GIT_DIR/hooks/update.d/ciabot _______________________________________________ Savannah-cvs mailing list [email protected] http://lists.gnu.org/mailman/listinfo/savannah-cvs
