Skip to content

Commit 47f43e8

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 3e5310a commit 47f43e8

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
@@ -2685,10 +2685,18 @@ if {![is_bare]} {
26852685
}
26862686
26872687
if {[is_Windows]} {
2688+
# Use /git-bash.exe if available
2689+
set normalized [file normalize $::argv0]
2690+
regsub "/mingw../libexec/git-core/git-gui$" \
2691+
$normalized "/git-bash.exe" cmdLine
2692+
if {$cmdLine != $normalized && [file exists $cmdLine]} {
2693+
set cmdLine [list "Git Bash" $cmdLine &]
2694+
} else {
2695+
set cmdLine [list "Git Bash" bash --login -l &]
2696+
}
26882697
.mbar.repository add command \
26892698
-label [mc "Git Bash"] \
2690-
-command {eval exec [auto_execok start] \
2691-
[list "Git Bash" bash --login -l &]}
2699+
-command {eval exec [auto_execok start] $cmdLine}
26922700
}
26932701
26942702
if {[is_Windows] || ![is_bare]} {

0 commit comments

Comments
 (0)