On 21/05/2025 14:17, Patrick Steinhardt wrote:
On Wed, May 21, 2025 at 02:07:25PM +0100, Phillip Wood wrote:
But don't we still need to change PATH so that hooks, shell aliases, git
rebase --exec, git bisect run, etc. still run the same git executable that
started them? For example "/usr/bin/git -c alias.g=!git g --version" should
report the version of /usr/bin/git, not ~/.local/bin/git which comes first
in my PATH if git doesn't change it.
There's two parts to this: PATH and GIT_EXEC_PATH. We do have to adjust
PATH indeed to contain the location of the 'git' executable. But we also
add GIT_EXEC_PATH to it, which I'm less sure whether it's actually
needed.
If we were to add /usr/bin to beginning of PATH when the user runs
/usr/bin/git I think that would be more surprising than adding
GIT_EXEC_PATH which is what we do now. When we add GIT_EXEC_PATH to the
beginning of PATH we only affect the lookup of git's programs. If
instead we added /usr/bin to the beginning that would affect the lookup
of many unrelated programs.
Best Wishes
Phillip