Re: What is the working directory for post-update hook?
- From
Junio C Hamano <junkio@cox.net>
- Date
- Feb 5, 2006, 09:41 UTC
- Message-ID
- <7vd5i2kuqi.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <200602050906.52016.alan@chandlerfamily.org.uk>
Alan Chandler <alan@chandlerfamily.org.uk> writes:
Show 9 quoted lines
> The document root of my website has a git repository under it (in the > standard .git subdirectory) and want a post update hook to checkout the > contents (so the web server sees it!) > > I will be pushing to it via ssh. > > Does this mean that the post-update hook with be run with a working directory > of the web site's document root? or something relative (such as GIT_DIR) so > that I don't have to do a specific cd to an absolute path.
The current implementation happens to chdir to GIT_DIR and sets GIT_DIR=. in the environment, so if you have something like this:
/var/www/myproject/
/var/www/myproject/.git/
/var/www/myproject/.git/HEAD
/var/www/myproject/.git/...
/var/www/myproject/READMEThen $(pwd) would be /var/www/myproject/.git/. Your hook would probably be able to do "cd .." to get to the project top.
However, there is no guarantee for future implementations.