git-gui (Windows): use git-bash.exe if it is available

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 <thomas.klaeger@10a.ch> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>

Thomas Klaeger committed Sep 26, 2019 at 10:46 UTC 6a72d44fc274db71f9b7350a2977a27cf13ca550
1 file changed +10 -2
git-gui.sh
+10 -2
@@ -2736,10 +2736,18 @@ if {![is_bare]} {
2736 }
2737
2738 if {[is_Windows]} {
2739 + # Use /git-bash.exe if available
2740 + set normalized [file normalize $::argv0]
2741 + regsub "/mingw../libexec/git-core/git-gui$" \
2742 + $normalized "/git-bash.exe" cmdLine
2743 + if {$cmdLine != $normalized && [file exists $cmdLine]} {
2744 + set cmdLine [list "Git Bash" $cmdLine &]
2745 + } else {
2746 + set cmdLine [list "Git Bash" bash --login -l &]
2747 + }
2748 .mbar.repository add command \
2749 -label [mc "Git Bash"] \
2741 - -command {eval exec [auto_execok start] \
2742 - [list "Git Bash" bash --login -l &]}
2750 + -command {eval exec [auto_execok start] $cmdLine}
2751 }
2752
2753 if {[is_Windows] || ![is_bare]} {