Skip to content

Commit 5133e74

Browse files
tomyydscho
authored andcommitted
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 #490 Signed-off-by: Thomas Kläger <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent e06c738 commit 5133e74

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

git-gui/git-gui.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2715,10 +2715,18 @@ if {![is_bare]} {
27152715
}
27162716
27172717
if {[is_Windows]} {
2718+
# Use /git-bash.exe if available
2719+
set normalized [file normalize $::argv0]
2720+
regsub "/mingw../libexec/git-core/git-gui$" \
2721+
$normalized "/git-bash.exe" cmdLine
2722+
if {$cmdLine != $normalized && [file exists $cmdLine]} {
2723+
set cmdLine [list "Git Bash" $cmdLine &]
2724+
} else {
2725+
set cmdLine [list "Git Bash" bash --login -l &]
2726+
}
27182727
.mbar.repository add command \
27192728
-label [mc "Git Bash"] \
2720-
-command {eval exec [auto_execok start] \
2721-
[list "Git Bash" bash --login -l &]}
2729+
-command {eval exec [auto_execok start] $cmdLine}
27222730
}
27232731
27242732
if {[is_Windows] || ![is_bare]} {

0 commit comments

Comments
 (0)