Re: [PATCH 4/4] drop git_exec_path() from non-Git commands' PATH
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- May 21, 2025, 15:27 UTC
- Message-ID
- <2a8221bf-5edb-449b-a4c9-3754350466d4@gmail.com>
- In-Reply-To
- <aC3SZtwQSt0mSVuo@pks.im>
On 21/05/2025 14:17, Patrick Steinhardt wrote:
Show 12 quoted lines
> 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