Skip to content

Commit

Permalink
git-gui (Windows): use git-gui.exe in Create Desktop Shortcut
Browse files Browse the repository at this point in the history
When calling `Repository>Create Desktop Shortcut`, Git GUI assumes
that it is okay to call `wish.exe` directly on Windows. However, in
Git for Windows 2.x' context, that leaves several crucial environment
variables uninitialized, resulting in a shortcut that does not work.

To fix those environment variable woes, Git for Windows comes with a
convenient `git-gui.exe`, so let's just use it when it is available.

This fixes git-for-windows#448

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Jan 12, 2016
1 parent 9b3376a commit ead3d6b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions git-gui/lib/shortcut.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit ead3d6b

Please sign in to comment.