Skip to content

Commit 6a72d44

Browse files
tomyyprati0100
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]> Signed-off-by: Pratyush Yadav <[email protected]>
1 parent 60c60b6 commit 6a72d44

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

git-gui.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2736,10 +2736,18 @@ if {![is_bare]} {
27362736
}
27372737
27382738
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+
}
27392748
.mbar.repository add command \
27402749
-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}
27432751
}
27442752
27452753
if {[is_Windows] || ![is_bare]} {

0 commit comments

Comments
 (0)