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> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

Pat Thoyts committed Oct 2, 2016 at 22:19 UTC f110c46902859832f798fc6777ac6bd0e661804a
1 file changed +7 -4
lib/shortcut.tcl
+7 -4
@@ -11,11 +11,14 @@ proc do_windows_shortcut {} {
11 if {[file extension $fn] ne {.lnk}} {
12 set fn ${fn}.lnk
13 }
14 + # Use git-gui.exe if available (ie: git-for-windows)
15 + set cmdLine [auto_execok git-gui.exe]
16 + if {$cmdLine eq {}} {
17 + set cmdLine [list [info nameofexecutable] \
18 + [file normalize $::argv0]]
19 + }
20 if {[catch {
15 - win32_create_lnk $fn [list \
16 - [info nameofexecutable] \
17 - [file normalize $::argv0] \
18 - ] \
21 + win32_create_lnk $fn $cmdLine \
22 [file normalize $_gitworktree]
23 } err]} {
24 error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]