git-gui (Windows): use git-gui.exe in Create Desktop Shortcut

When calling `Repository>Create Desktop Shortcut`, Git GUI assumes
that it is okay to call `wish.exe` directly on Windows. However, in
Git for Windows 2.x' context, that leaves several crucial environment
variables uninitialized, resulting in a shortcut that does not work.

To fix those environment variable woes, Git for Windows comes with a
convenient `git-gui.exe`, so let's just use it when it is available.

This fixes https://github.com/git-for-windows/git/issues/448

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2015-09-29 23:07:17 +02:00
parent 369745e566
commit 55504f82e9

View File

@@ -11,11 +11,17 @@ proc do_windows_shortcut {} {
if {[file extension $fn] ne {.lnk}} {
set fn ${fn}.lnk
}
# Use /cmd/git-gui.exe if available
set normalized [file normalize $::argv0]
regsub "/mingw../libexec/git-core/git-gui$" \
$normalized "/cmd/git-gui.exe" cmdLine
if {$cmdLine != $normalized && [file exists $cmdLine]} {
set cmdLine [list [file nativename $cmdLine]]
} else {
set cmdLine [list [info nameofexecutable] $normalized]
}
if {[catch {
win32_create_lnk $fn [list \
[info nameofexecutable] \
[file normalize $::argv0] \
] \
win32_create_lnk $fn $cmdLine \
[file normalize $_gitworktree]
} err]} {
error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]