Skip to content

Commit 0445747

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 git-for-windows#490 Signed-off-by: Thomas Kläger <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 42e165c commit 0445747

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
@@ -2678,10 +2678,18 @@ if {![is_bare]} {
26782678
}
26792679
26802680
if {[is_Windows]} {
2681+
# Use /git-bash.exe if available
2682+
set normalized [file normalize $::argv0]
2683+
regsub "/mingw../libexec/git-core/git-gui$" \
2684+
$normalized "/git-bash.exe" cmdLine
2685+
if {$cmdLine != $normalized && [file exists $cmdLine]} {
2686+
set cmdLine [list "Git Bash" $cmdLine &]
2687+
} else {
2688+
set cmdLine [list "Git Bash" bash --login -l &]
2689+
}
26812690
.mbar.repository add command \
26822691
-label [mc "Git Bash"] \
2683-
-command {eval exec [auto_execok start] \
2684-
[list "Git Bash" bash --login -l &]}
2692+
-command {eval exec [auto_execok start] $cmdLine}
26852693
}
26862694
26872695
if {[is_Windows] || ![is_bare]} {

0 commit comments

Comments
 (0)