From: Patrick Steinhardt Date: Mon, 26 May 2025 06:34:03 GMT Subject: Re: [PATCH 4/4] drop git_exec_path() from non-Git commands' PATH Message-ID: In-Reply-To: <2a8221bf-5edb-449b-a4c9-3754350466d4@gmail.com> On Wed, May 21, 2025 at 04:27:48PM +0100, Phillip Wood wrote: > 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. That's a valid point indeed. Patrick