From d1c98b4d2fb59c74b68be863a426b97fa92b4aaa Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 29 Sep 2015 22:47:34 +0200 Subject: [PATCH 1/3] 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 --- git-gui/git-gui.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh index 0f9f4ac68e..ebd4da7930 100755 --- a/git-gui/git-gui.sh +++ b/git-gui/git-gui.sh @@ -270,12 +270,10 @@ proc is_Windows {} { proc is_Cygwin {} { global _iscygwin if {$_iscygwin eq {}} { - if {$::tcl_platform(platform) eq {windows}} { - if {[catch {set p [exec cygpath --windir]} err]} { - set _iscygwin 0 - } else { - set _iscygwin 1 - } + if {$::tcl_platform(platform) eq {windows} && + (![info exists ::env(MSYSTEM)] || + $::env(MSYSTEM) eq {MSYS})} { + set _iscygwin 1 } else { set _iscygwin 0 } From dc91269eeea5f21a7a16ff5ced4a811e8290232b Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 29 Sep 2015 23:07:17 +0200 Subject: [PATCH 2/3] 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 --- git-gui/lib/shortcut.tcl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/git-gui/lib/shortcut.tcl b/git-gui/lib/shortcut.tcl index 78878ef89d..715916b659 100644 --- a/git-gui/lib/shortcut.tcl +++ b/git-gui/lib/shortcut.tcl @@ -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"] From 81ee98e51456bae89b2d1d3aa68df8dc7f8dbc0f Mon Sep 17 00:00:00 2001 From: Thomas Klaeger Date: Sun, 18 Oct 2015 22:31:36 +0200 Subject: [PATCH 3/3] git-gui (Windows): use git-bash.exe if it is available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Git for Windows 2.x ships with an executable that starts the Git Bash with all the environment variables and what not properly set up. It is also adjusted according to the Terminal emulator option chosen when installing Git for Windows (while `bash.exe --login -i` would always launch with Windows' default console). So let's use that executable (usually C:\Program Files\Git\git-bash.exe) instead of `bash.exe --login -i` if its presence was detected. This fixes https://github.com/git-for-windows/git/issues/490 Signed-off-by: Thomas Kläger Signed-off-by: Johannes Schindelin --- git-gui/git-gui.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh index ebd4da7930..713d51e024 100755 --- a/git-gui/git-gui.sh +++ b/git-gui/git-gui.sh @@ -2685,10 +2685,18 @@ if {![is_bare]} { } if {[is_Windows]} { + # Use /git-bash.exe if available + set normalized [file normalize $::argv0] + regsub "/mingw../libexec/git-core/git-gui$" \ + $normalized "/git-bash.exe" cmdLine + if {$cmdLine != $normalized && [file exists $cmdLine]} { + set cmdLine [list "Git Bash" $cmdLine &] + } else { + set cmdLine [list "Git Bash" bash --login -l &] + } .mbar.repository add command \ -label [mc "Git Bash"] \ - -command {eval exec [auto_execok start] \ - [list "Git Bash" bash --login -l &]} + -command {eval exec [auto_execok start] $cmdLine} } if {[is_Windows] || ![is_bare]} {