Re: PATH modifications for git-hook processes

2015-04-22 Thread Junio C Hamano
Jeff King writes: > IOW, you can do things like > > alias git=/opt/my-git/git > > and all the "git" commands will automatically work fine, even if you > didn't know at compile time where you would install them, and you didn't > set GIT_EXEC_DIR at run-time. It will still first loo

Re: PATH modifications for git-hook processes

2015-04-21 Thread David Rodríguez
Jeff King peff.net> writes: > > If we can get away with just dropping this element from the PATH, I'd > much rather do that than try to implement a complicated path-precedence > scheme. > > -Peff > I agree, GIT_EXEC_DIR should be enough and this surprising behavior would be avoided. -- To uns

Re: PATH modifications for git-hook processes

2015-04-15 Thread Jeff King
On Thu, Apr 16, 2015 at 02:17:32AM -0400, Jeff King wrote: > So it uses a special git-specific version of exec, and doesn't touch the > PATH. Later, we did 231af83 (Teach the "git" command to handle some > commands internally, 2006-02-26), which says at the end: > >There's one other change: t

Re: PATH modifications for git-hook processes

2015-04-15 Thread Jeff King
On Wed, Apr 15, 2015 at 11:00:20AM -0400, Matthew Rothenberg wrote: > So, I guess what I'm looking for is: > - A way to prevent the **path to the running "git" itself** portion > of setup_path from firing, (OR) Yeah, this behavior leaves me somewhat confused. It is obviously dangerous (since we

Re: PATH modifications for git-hook processes

2015-04-15 Thread Matthew Rothenberg
Hmm, this all makes sense as to why it's happening, thank you. In my case the ` /usr/local/Cellar/git/2.3.5/libexec/git-core` (git --exec-path) does give all the proper binaries and sub-binaries. It shows up twice because the GIT_EXEC_PATH environment variable is used too (which is the same in my

Re: PATH modifications for git-hook processes

2015-04-14 Thread Junio C Hamano
Matthew Rothenberg writes: > - what is the expected PATH modification behavior for subprocesses of > git-hooks? Is this documented anywhere? > - what would be causing /usr/local/bin to be prepended here, and can > it be adjusted via preference? This is not limited to hooks and very much delibe

PATH modifications for git-hook processes

2015-04-14 Thread Matthew Rothenberg
Using git 2.3.5 (on darwin, installed via homebrew), when executing a script via the commit-msg githook, the following gets *prepended* to the $PATH for the subprocess: /usr/local/Cellar/git/2.3.5/libexec/git-core:/usr/local/Cellar/git/2.3.5/libexec/git-core:/usr/local/bin:{rest of path...} I