Skip to content

Commit b76a5a8

Browse files
committed
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 be700fe, 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 99fe594, 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 <[email protected]>
1 parent 3f07230 commit b76a5a8

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

git-gui.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,6 @@ if {[is_Windows]} {
8787
set _search_exe {}
8888
}
8989

90-
if {[is_Windows]} {
91-
set gitguidir [file dirname [info script]]
92-
regsub -all ";" $gitguidir "\\;" gitguidir
93-
set env(PATH) "$gitguidir;$env(PATH)"
94-
}
95-
9690
set _search_path {}
9791
set _path_seen [dict create]
9892
foreach p [split $env(PATH) $_path_sep] {

windows/git-gui.sh

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,5 @@ if { $argc >=2 && [lindex $argv 0] == "--working-dir" } {
1313
incr argc -2
1414
}
1515

16-
set basedir [file dirname \
17-
[file dirname \
18-
[file dirname [info script]]]]
19-
set bindir [file join $basedir bin]
20-
set bindir "$bindir;[file join $basedir mingw bin]"
21-
regsub -all ";" $bindir "\\;" bindir
22-
set env(PATH) "$bindir;$env(PATH)"
23-
unset bindir
24-
25-
source [file join [file dirname [info script]] git-gui.tcl]
16+
set thisdir [file normalize [file dirname [info script]]]
17+
source [file join $thisdir git-gui.tcl]

0 commit comments

Comments
 (0)