From 00ff9dd1c0911f757a68654a28486e19f2326a3b Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Sun, 2 Oct 2016 11:51:29 +0100 Subject: [PATCH 1/2] git-gui: fix detection of Cygwin MSys2 might *look* like Cygwin, but it is *not* Cygwin... Unless it is run with `MSYSTEM=MSYS`, that is. Signed-off-by: Johannes Schindelin Signed-off-by: Pat Thoyts Signed-off-by: Johannes Schindelin --- git-gui/git-gui.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh index 11048c7a0e..2381c3e548 100755 --- a/git-gui/git-gui.sh +++ b/git-gui/git-gui.sh @@ -275,6 +275,10 @@ proc is_Cygwin {} { set _iscygwin 0 } else { set _iscygwin 1 + # Handle MSys2 which is only cygwin when MSYSTEM is MSYS. + if {[info exists ::env(MSYSTEM)] && $::env(MSYSTEM) ne "MSYS"} { + set _iscygwin 0 + } } } else { set _iscygwin 0 From 235860a368ada0e0fe9d66a11857a411cbd7ed39 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Sun, 2 Oct 2016 22:19:47 +0100 Subject: [PATCH 2/2] 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 Signed-off-by: Pat Thoyts Signed-off-by: Johannes Schindelin --- git-gui/lib/shortcut.tcl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/git-gui/lib/shortcut.tcl b/git-gui/lib/shortcut.tcl index 78878ef89d..39d23f96df 100644 --- a/git-gui/lib/shortcut.tcl +++ b/git-gui/lib/shortcut.tcl @@ -11,11 +11,14 @@ proc do_windows_shortcut {} { if {[file extension $fn] ne {.lnk}} { set fn ${fn}.lnk } + # Use git-gui.exe if available (ie: git-for-windows) + set cmdLine [auto_execok git-gui.exe] + if {$cmdLine eq {}} { + set cmdLine [list [info nameofexecutable] \ + [file normalize $::argv0]] + } 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"]