Subversion post-commit hooks
Posted by: ocfoodreview
Posted on: 2006-07-28 10:41:00
Hi, someone posted the same question a while back, but never got a response, so I'm just going to ask again. I have two directories, svn and labs. The svn directory holds my subversion project and I'd like labs to be a staging area for my site. When I commit to Subversion, I'd like the labs folder to be synchronized. Clearly, this calls for a post-commit hook which I wrote as:
#!/bin/sh
/usr/bin/svn update /home/[account]/labs
Unfortunately, after I commit documents, svn update is never run. Does anyone have any suggestions on how to fix this? I've even tried moving the command to an external script as follows:
---post-commit (chmod'd +x)----
#!/bin/sh
/home/[account]/svn/[project]/hooks/post-commit.php
---post-commit.php-----
#!/usr/local/bin/php -q
<?php
shell_exec('/usr/bin/svn update /home/[account]/labs');
?>
Both of these methods will work properly if I execute it from the shell (even if I run them with $PATH cleared, env -i /home/[account]/svn/[project]/hooks/post-commit), but not when I commit through Subversion. This lead me to suspect it might be a permission problem (since commit will run as the dhapache user). The labs directory was chmod'd 755, but that still did not help. Any suggestions?