PATH modifications for git-hook processes
From: Matthew Rothenberg <hidden>
Date: 2016-06-15 23:04:25
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 can't find any documentation about this path modification behavior
in the git docs, and I'm not familiar enough with the source code to
locate it there either.
In our case, the prepending of /usr/local/bin is particularly
problematic, as it effectively reorders our chosen PATH hierarchy (in
which user-space versions of commands are picked up prior to system
installed ones).
(It's also curious that the git-core directory gets prepended twice,
but that doesn't cause us any particular issues.)
My questions:
- 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?
Thanks!