Search code examples
linuxsvnbashpost-commit

Where do I put a post-commit hook script?


I've just thrown together the following shell script:

cd /home/firefli/webprojects/project1
svn checkout file:///home/firefli/svn/project1/trunk .
rm -rf /home/firefli/public_html/project1
svn export . /home/firefli/public_html/project1

It does work when I do a commit and then run the script manually but I still have a couple of questions.

Can I run a bash script, or does it have to be C? (I've seen lots of C examples)

Where do I put it to make it execute post-commit?


Solution

  • There is a hooks directory inside your Subversion repository. It should contain a number of templates that you can modify and use.

    Your script can happily be a bash script. The provided templates use /bin/sh

    Just remove the .tmpl extension and you're good to go.

    The Subversion docs provide more info here