From: Daniel Barkalow Date: Wed, 07 Dec 2005 17:47:39 GMT Subject: Re: [RFC] Run hooks with a cleaner environment Message-ID: In-Reply-To: <7voe3tzqn8.fsf@assigned-by-dhcp.cox.net> On Tue, 6 Dec 2005, Junio C Hamano wrote: > Daniel Barkalow writes: > > > GIT_DIR is set to the repository that got the push, > > That is done by receive-pack; it chdir()s into the repository > and does its thing, and the hooks are called from there; I'd > expect cwd to be the repository ('.git'), GIT_DIR to be dot > ('.'). I thought I was seeing the full path of the repository as GIT_DIR and I didn't check the cwd. > I think doing the "unset GIT_DIR" to be the first thing if you > want to access some other repository is documented somewhere but > if not please send a patch to document it. I didn't see it in the place "grep post-update Documentation/*" returned, so we need something. (Actually, the main thing is to specify that nothing else special is set, because the GIT_DIR thing was pretty obvious, but I then didn't know if my problems were due to something else undocumented.) > As to file descriptors, I think duping the output to original > stderr might make sense, but I do not know what breaks, so > interested parties may want to test it out and submit a tested > patch for inclusion. I'll send a patch tonight which works for me, but it should probably be checked over by people who are good at this sort of stuff. I've got a "/dev/null" patch; I'll look into a version that tries to find a controlling tty (which could be really interesting, since you could then have the hook get input from the user), or at least copy stderr if possible. For reference, the error I was getting was a broken pipe writing to stdout (as git merge does somewhere) when I've pushed locally. -Daniel *This .sig left intentionally blank*