Monday, 12 August 2013

Post-receive hook for website publishing - selected files not working

Post-receive hook for website publishing - selected files not working

Based on this answer I tried to implement the following:
When pushing to the web repo, I do not want the whole repository contents
to be copied to my web directory, but only certain files/directories.
So, in my post-receive hook I do this:
GIT_WORK_TREE=/full/path/to/web/directory git checkout -f -- web/index.php
However, very strangely the version of index.php in the directory never
updates correctly. While a git log inside my bare repository directory
showed the latest commits that were pushed to it the version of index.php
is a previous one.
Also, I created a file called test and added that to the paths above to be
copied into the work tree - this also did not show up.
The file is definitely executed. I added an echo command that shows up on
my console, and I do some cleanup in the directory that is working as
expected. All the files are there and updated. (I checked with a brand new
git clone.)
All this is very frustrating because it worked well when I first set it
up. Don't know what could be wrong here. Thanks.

No comments:

Post a Comment