{"thread":{"id":"40679","subject":"[PATCH 2/2] git-gui (Windows): use git-gui.exe in `Create Desktop Shortcut`","startedAt":"2015-10-30T19:09:57Z","lastAt":"2015-10-30T19:10:07Z","messageCount":2,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"272563","messageId":"alpine.DEB.1.00.1510302009510.31610@s15462909.onlinehome-server.info","threadId":"40679","inReplyTo":"cover.1443619795.git.johannes.schindelin@gmx.de","subject":"[PATCH 1/2] git-gui: fix detection of Cygwin","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2015-10-30T19:09:57Z","receivedAt":"2015-10-30T19:09:57Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"MSys2 might *look* like Cygwin, but it is *not* Cygwin... Unless it\nis run with `MSYSTEM=MSYS`, that is.\n\nThis change is backwards-compatible because MSys also used the\nMSYSTEM variable to determine whether to run in MSys or in MinGW\nmode. The only difference is that MSys does not support running\nin 64-bit mode at all.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n git-gui.sh | 10 ++++------\n 1 file changed, 4 insertions(+), 6 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 11048c7..9038a4c 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -270,12 +270,10 @@ proc is_Windows {} {\n proc is_Cygwin {} {\n \tglobal _iscygwin\n \tif {$_iscygwin eq {}} {\n-\t\tif {$::tcl_platform(platform) eq {windows}} {\n-\t\t\tif {[catch {set p [exec cygpath --windir]} err]} {\n-\t\t\t\tset _iscygwin 0\n-\t\t\t} else {\n-\t\t\t\tset _iscygwin 1\n-\t\t\t}\n+\t\tif {$::tcl_platform(platform) eq {windows} &&\n+\t\t\t\t(![info exists ::env(MSYSTEM)] ||\n+\t\t\t\t $::env(MSYSTEM) ne {MSYS})} {\n+\t\t\tset _iscygwin 1\n \t\t} else {\n \t\t\tset _iscygwin 0\n \t\t}\n-- \n2.5.3.windows.1.3.gc322723\n"},{"id":"272562","messageId":"alpine.DEB.1.00.1510302010010.31610@s15462909.onlinehome-server.info","threadId":"40679","inReplyTo":"cover.1443619795.git.johannes.schindelin@gmx.de","subject":"[PATCH 2/2] git-gui (Windows): use git-gui.exe in `Create Desktop Shortcut`","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2015-10-30T19:10:07Z","receivedAt":"2015-10-30T19:10:07Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"When calling `Repository>Create Desktop Shortcut`, Git GUI assumes\nthat it is okay to call `wish.exe` directly on Windows. However, in\nGit for Windows 2.x' context, that leaves several crucial environment\nvariables uninitialized, resulting in a shortcut that does not work.\n\nTo fix those environment variable woes, Git for Windows comes with a\nconvenient `git-gui.exe`, so let's just use it when it is available.\n\nThis fixes https://github.com/git-for-windows/git/issues/448\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n lib/shortcut.tcl | 14 ++++++++++----\n 1 file changed, 10 insertions(+), 4 deletions(-)\n\ndiff --git a/lib/shortcut.tcl b/lib/shortcut.tcl\nindex 78878ef..715916b 100644\n--- a/lib/shortcut.tcl\n+++ b/lib/shortcut.tcl\n@@ -11,11 +11,17 @@ proc do_windows_shortcut {} {\n \t\tif {[file extension $fn] ne {.lnk}} {\n \t\t\tset fn ${fn}.lnk\n \t\t}\n+\t\t# Use /cmd/git-gui.exe if available\n+\t\tset normalized [file normalize $::argv0]\n+\t\tregsub \"/mingw../libexec/git-core/git-gui$\" \\\n+\t\t\t$normalized \"/cmd/git-gui.exe\" cmdLine\n+\t\tif {$cmdLine != $normalized && [file exists $cmdLine]} {\n+\t\t\tset cmdLine [list [file nativename $cmdLine]]\n+\t\t} else {\n+\t\t\tset cmdLine [list [info nameofexecutable] $normalized]\n+\t\t}\n \t\tif {[catch {\n-\t\t\t\twin32_create_lnk $fn [list \\\n-\t\t\t\t\t[info nameofexecutable] \\\n-\t\t\t\t\t[file normalize $::argv0] \\\n-\t\t\t\t\t] \\\n+\t\t\t\twin32_create_lnk $fn $cmdLine \\\n \t\t\t\t\t[file normalize $_gitworktree]\n \t\t\t} err]} {\n \t\t\terror_popup [strcat [mc \"Cannot write shortcut:\"] \"\\n\\n$err\"]\n-- \n2.5.3.windows.1.3.gc322723\n"}]}