Commit | Line | Data |
---|---|---|
31d5f75f LMM |
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 -type d -maxdepth 1 -name '*git'); do | |
29 | rsync -avrSPX --delete $working_copy/hooks/* $REPO_DIR/{$working_copy//*\//}/hooks/ | |
30 | done | |
31 | ||
32 | exec git update-server-info | |
33 | ||
34 |