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 <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2016-08-12 16:06:51 +02:00
2 changed files with 24 additions and 12 deletions

View File

@@ -270,12 +270,10 @@ proc is_Windows {} {
proc is_Cygwin {} {
global _iscygwin
if {$_iscygwin eq {}} {
if {$::tcl_platform(platform) eq {windows}} {
if {[catch {set p [exec cygpath --windir]} err]} {
set _iscygwin 0
} else {
set _iscygwin 1
}
if {$::tcl_platform(platform) eq {windows} &&
(![info exists ::env(MSYSTEM)] ||
$::env(MSYSTEM) eq {MSYS})} {
set _iscygwin 1
} else {
set _iscygwin 0
}
@@ -2669,10 +2667,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]} {

View File

@@ -11,11 +11,17 @@ proc do_windows_shortcut {} {
if {[file extension $fn] ne {.lnk}} {
set fn ${fn}.lnk
}
# Use /cmd/git-gui.exe if available
set normalized [file normalize $::argv0]
regsub "/mingw../libexec/git-core/git-gui$" \
$normalized "/cmd/git-gui.exe" cmdLine
if {$cmdLine != $normalized && [file exists $cmdLine]} {
set cmdLine [list [file nativename $cmdLine]]
} else {
set cmdLine [list [info nameofexecutable] $normalized]
}
if {[catch {
win32_create_lnk $fn [list \
[info nameofexecutable] \
[file normalize $::argv0] \
] \
win32_create_lnk $fn $cmdLine \
[file normalize $_gitworktree]
} err]} {
error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]