Skip to content

Commit

Permalink
git-gui: Fix gitk search in $PATH to work on Windows
Browse files Browse the repository at this point in the history
Back in 15430be ("Look for gitk in $PATH, not $LIBEXEC/git-core")
git-gui learned to use [_which gitk] to locate where gitk's script
is as Git 1.6 will install gitk to $prefix/bin (in $PATH) and all
of the other tools are in $gitexecdir.

This failed on Windows because _which adds the ".exe" suffix as it
searches for the program on $PATH, under the assumption that we can
only execute something from Tcl if it is a proper Windows executable.

When scanning for gitk on Windows we need to omit the ".exe" suffix.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
  • Loading branch information
Shawn O. Pearce committed Jul 30, 2008
1 parent 25b8fb1 commit 79317e5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions git-gui.sh
Original file line number Diff line number Diff line change
@@ -317,7 +317,7 @@ proc _git_cmd {name} {
return $v
}

proc _which {what} {
proc _which {what args} {
global env _search_exe _search_path

if {$_search_path eq {}} {
@@ -340,8 +340,14 @@ proc _which {what} {
}
}
if {[is_Windows] && [lsearch -exact $args -script] >= 0} {
set suffix {}
} else {
set suffix $_search_exe
}
foreach p $_search_path {
set p [file join $p $what$_search_exe]
set p [file join $p $what$suffix]
if {[file exists $p]} {
return [file normalize $p]
}
@@ -1686,7 +1692,7 @@ proc do_gitk {revs} {
# -- Always start gitk through whatever we were loaded with. This
# lets us bypass using shell process on Windows systems.
#
set exe [_which gitk]
set exe [_which gitk -script]
set cmd [list [info nameofexecutable] $exe]
if {$exe eq {}} {
error_popup [mc "Couldn't find gitk in PATH"]

0 comments on commit 79317e5

Please sign in to comment.