Skip to content

Commit

Permalink
git-gui (Windows): use git-bash.exe if it is available
Browse files Browse the repository at this point in the history
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/git#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>
  • Loading branch information
tomyy authored and prati0100 committed Oct 1, 2019
1 parent 60c60b6 commit 6a72d44
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2736,10 +2736,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]} {
Expand Down

0 comments on commit 6a72d44

Please sign in to comment.