From: Mark Levedahl Date: Sun, 13 Apr 2025 18:15:08 +0000 (-0400) Subject: git-gui: do not add directories to PATH on Windows X-Git-Tag: v2.51.0-rc1~9^2~4^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b76a5a854bfae6542eec333365b218c5bc0fdf5b;p=thirdparty%2Fgit.git git-gui: do not add directories to PATH on Windows git-gui on Windows prepends three directories to PATH so does not honor PATH as configured. This can have undesirable consequences, for instance by preventing use of a different git for testing. This also provides at best a subset of the configuration included with Git for Windows (g4w), so is neither necessary nor sufficient there. Since commit be700fe3, git-gui.sh adds its directory to the front of PATH: this is essentially adding $(git --execdir) to the path, this is long deprecated as git moved to using "dashless" subcommands. The windows/git-gui.sh wrapper file, since commit 99fe594d, adds two directories relative to its installed location to PATH, and does so without checking that either exists or is needed. The above modifications were made before the Git For Windows project took responsibility for distributing a working solution on Windows. g4w assures a correct configuration on Windows without these, and doing so requires more than the above modifications. See [1] for a more thorough treatment. git-gui does not modify PATH on any platform except on Windows, and doing so is not needed by g4w. Let's stop modifying PATH on Windows as well. [1] https://gitforwindows.org/git-wrapper.html Signed-off-by: Mark Levedahl --- diff --git a/git-gui.sh b/git-gui.sh index c77c05edde..8d97817908 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -87,12 +87,6 @@ if {[is_Windows]} { set _search_exe {} } -if {[is_Windows]} { - set gitguidir [file dirname [info script]] - regsub -all ";" $gitguidir "\\;" gitguidir - set env(PATH) "$gitguidir;$env(PATH)" -} - set _search_path {} set _path_seen [dict create] foreach p [split $env(PATH) $_path_sep] { diff --git a/windows/git-gui.sh b/windows/git-gui.sh index b1845c5055..38debe376c 100755 --- a/windows/git-gui.sh +++ b/windows/git-gui.sh @@ -13,13 +13,5 @@ if { $argc >=2 && [lindex $argv 0] == "--working-dir" } { incr argc -2 } -set basedir [file dirname \ - [file dirname \ - [file dirname [info script]]]] -set bindir [file join $basedir bin] -set bindir "$bindir;[file join $basedir mingw bin]" -regsub -all ";" $bindir "\\;" bindir -set env(PATH) "$bindir;$env(PATH)" -unset bindir - -source [file join [file dirname [info script]] git-gui.tcl] +set thisdir [file normalize [file dirname [info script]]] +source [file join $thisdir git-gui.tcl]