Skip to content

Commit c2dab60

Browse files
committed
Merge branch 'msys2-git-gui'
This topic branch addresses the bug where Git for Windows 2.x' Git GUI failed to generate a working shortcut via Repository>Create Desktop Shortcut. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents afe0721 + 9f47756 commit c2dab60

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

git-gui/git-gui.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,10 @@ proc is_Windows {} {
270270
proc is_Cygwin {} {
271271
global _iscygwin
272272
if {$_iscygwin eq {}} {
273-
if {$::tcl_platform(platform) eq {windows}} {
274-
if {[catch {set p [exec cygpath --windir]} err]} {
275-
set _iscygwin 0
276-
} else {
277-
set _iscygwin 1
278-
}
273+
if {$::tcl_platform(platform) eq {windows} &&
274+
(![info exists ::env(MSYSTEM)] ||
275+
$::env(MSYSTEM) eq {MSYS})} {
276+
set _iscygwin 1
279277
} else {
280278
set _iscygwin 0
281279
}
@@ -2669,10 +2667,18 @@ if {![is_bare]} {
26692667
}
26702668
26712669
if {[is_Windows]} {
2670+
# Use /git-bash.exe if available
2671+
set normalized [file normalize $::argv0]
2672+
regsub "/mingw../libexec/git-core/git-gui$" \
2673+
$normalized "/git-bash.exe" cmdLine
2674+
if {$cmdLine != $normalized && [file exists $cmdLine]} {
2675+
set cmdLine [list "Git Bash" $cmdLine &]
2676+
} else {
2677+
set cmdLine [list "Git Bash" bash --login -l &]
2678+
}
26722679
.mbar.repository add command \
26732680
-label [mc "Git Bash"] \
2674-
-command {eval exec [auto_execok start] \
2675-
[list "Git Bash" bash --login -l &]}
2681+
-command {eval exec [auto_execok start] $cmdLine}
26762682
}
26772683
26782684
if {[is_Windows] || ![is_bare]} {

git-gui/lib/shortcut.tcl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@ proc do_windows_shortcut {} {
1111
if {[file extension $fn] ne {.lnk}} {
1212
set fn ${fn}.lnk
1313
}
14+
# Use /cmd/git-gui.exe if available
15+
set normalized [file normalize $::argv0]
16+
regsub "/mingw../libexec/git-core/git-gui$" \
17+
$normalized "/cmd/git-gui.exe" cmdLine
18+
if {$cmdLine != $normalized && [file exists $cmdLine]} {
19+
set cmdLine [list [file nativename $cmdLine]]
20+
} else {
21+
set cmdLine [list [info nameofexecutable] $normalized]
22+
}
1423
if {[catch {
15-
win32_create_lnk $fn [list \
16-
[info nameofexecutable] \
17-
[file normalize $::argv0] \
18-
] \
24+
win32_create_lnk $fn $cmdLine \
1925
[file normalize $_gitworktree]
2026
} err]} {
2127
error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]

0 commit comments

Comments
 (0)