]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-gui: _which, only add .exe suffix if not present
authorMark Levedahl <mlevedahl@gmail.com>
Thu, 3 Apr 2025 14:26:21 +0000 (10:26 -0400)
committerTaylor Blau <me@ttaylorr.com>
Fri, 23 May 2025 21:04:23 +0000 (17:04 -0400)
The _which function finds executables on $PATH, and adds .exe on Windows
unless -script was given. However, win32.tcl executes "wscript.exe"
and "cscript.exe", both of which fail as _which adds .exe to both. This
is already fixed in git-gui released by Git for Windows. Do so here.

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
git-gui.sh

index 3e5907a4609b1510aef71ab54f56a82eeb36e071..2e079b6ab138a1e568f9815f82677dcea2bcd285 100755 (executable)
@@ -101,6 +101,9 @@ proc _which {what args} {
 
        if {[is_Windows] && [lsearch -exact $args -script] >= 0} {
                set suffix {}
+       } elseif {[is_Windows] && [string match *$_search_exe [string tolower $what]]} {
+               # The search string already has the file extension
+               set suffix {}
        } else {
                set suffix $_search_exe
        }