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 #448

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Sep 30, 2015
1 parent 15c3576 commit 51afad7
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 51afad7

Please sign in to comment.