[RFC] Run hooks with a cleaner environment
- From
Daniel Barkalow <barkalow@iabervon.org>
- Date
- Dec 6, 2005, 22:43 UTC
- Message-ID
- <Pine.LNX.4.64.0512061716030.25300@iabervon.org>
Currently, hooks/post-update is run in the environment that receive-pack is run. This means that there are a number of things that are unpredictable. I'd like to make it set things up in a more predictable and useful way. The things I know are odd:
stdout and stdin are connected to send-pack, either by broken pipes (for local pushes) or an ignored socket (via ssh). stdin should probably be /dev/null, and stdout should be either a log file or /dev/null. stderr is still the push's stderr, which may or may not be desired.
GIT_DIR is set to the repository that got the push, which may surprise people who only use it in "GIT_DIR=foo git ..." form and don't expect it ever to be set from outside. Of course, it's potentially useful to know what repository is running the hook, but that doesn't have to be communicated in such a way that git programs will pick it up directly. Other environment variables could potentially be purged, too, but I don't think that's as important, since the user probably knows about them.
cwd is set to the push's cwd if it's local, maybe $HOME if it's over ssh. It should probably always be $HOME, unless we want it to be $GIT_DIR.
Is there anything else we want to regularize? Is there some sort of standard behavior we should match, like CVS or cron?
-Daniel *This .sig left intentionally blank*