Added more details to deploy-hooks
[deploy-hooks.git] / deploy-hooks.git / post-update
1 #!/bin/bash
2
3 unset GIT_DIR
4 SELF=deploy-hooks.git
5 REPO_DIR=$HOME/repositories
6 CHECKOUT_DIR=$HOME/local/checkouts/deploy-hooks
7
8 case $1 in
9 refs/heads/stable)
10 echo "Updating hooks on vcs.fsf.org..."
11 ;;
12 *)
13 echo 'No rules for this branch!'
14 exit 0
15 ;;
16 esac
17
18 echo "Updating local checkout..."
19 if [ ! -d $CHECKOUT_DIR ]; then
20 git clone $REPO_DIR/$SELF $CHECKOUT_DIR
21 git checkout stable
22 else
23 cd $CHECKOUT_DIR
24 git pull origin stable
25 fi
26
27 echo "Syncing hooks..."
28 for working_copy in $(find $CHECKOUT_DIR -maxdepth 1 -name '*.git' -type d | grep -v '/.git'); do
29 echo Updating remote hooks for: ${working_copy//*\//}/hooks/
30 rsync -avrSPX --delete $working_copy/* $REPO_DIR/${working_copy//*\//}/hooks/
31 done
32
33 exec git update-server-info
34
35