]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-gui: do not add directories to PATH on Windows
authorMark Levedahl <mlevedahl@gmail.com>
Sun, 13 Apr 2025 18:15:08 +0000 (14:15 -0400)
committerMark Levedahl <mlevedahl@gmail.com>
Sat, 19 Jul 2025 12:21:10 +0000 (08:21 -0400)
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 <mlevedahl@gmail.com>
git-gui.sh
windows/git-gui.sh

index c77c05edde3b544e3903167e82f6d6ab25843e14..8d97817908502e7e9d33c927e192edc92be8631e 100755 (executable)
@@ -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] {
index b1845c505500a0f079b2299de07d481c6b2550c4..38debe376c2a8f8174496a20a15fe8a3d5da4c29 100755 (executable)
@@ -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]