Git fork

Merge branch 'ml/windows-tie-loose-ends'

* ml/windows-tie-loose-ends:
git-gui: use /cmd/git-gui.exe for shortcut
git-gui: Windows tk_getSaveFile is not useful for shortcuts
git-gui: let nice work on Windows
git-gui: do not add directories to PATH on Windows

Signed-off-by: Johannes Sixt <j6t@kdbg.org>

+35 -37
-8
git-gui.sh
··· 83 83 set _path_sep {:} 84 84 } 85 85 86 - if {[is_Windows]} { 87 - set gitguidir [file dirname [info script]] 88 - regsub -all ";" $gitguidir "\\;" gitguidir 89 - set env(PATH) "$gitguidir;$env(PATH)" 90 - } 91 - 92 86 set _search_path {} 93 87 set _path_seen [dict create] 94 88 foreach p [split $env(PATH) $_path_sep] { ··· 574 568 if {![info exists _nice]} { 575 569 set _nice [_which nice] 576 570 if {[catch {safe_exec [list $_nice git version]}]} { 577 - set _nice {} 578 - } elseif {[is_Windows] && [file dirname $_nice] ne [file dirname $::_git]} { 579 571 set _nice {} 580 572 } 581 573 }
+33 -19
lib/shortcut.tcl
··· 3 3 4 4 proc do_windows_shortcut {} { 5 5 global _gitworktree 6 - set fn [tk_getSaveFile \ 7 - -parent . \ 8 - -title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \ 9 - -initialfile "Git [reponame].lnk"] 10 - if {$fn != {}} { 11 - if {[file extension $fn] ne {.lnk}} { 12 - set fn ${fn}.lnk 13 - } 14 - # Use git-gui.exe if available (ie: git-for-windows) 15 - set cmdLine [list [_which git-gui]] 16 - if {$cmdLine eq {}} { 17 - set cmdLine [list [info nameofexecutable] \ 18 - [file normalize $::argv0]] 19 - } 20 - if {[catch { 21 - win32_create_lnk $fn $cmdLine \ 22 - [file normalize $_gitworktree] 23 - } err]} { 24 - error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"] 6 + 7 + set desktop [safe_exec [list cygpath -mD]] 8 + set link_file "Git [reponame].lnk" 9 + set link_path [file normalize [file join $desktop $link_file]] 10 + 11 + # on Windows, tk_getSaveFile dereferences .lnk files, so no simple 12 + # filename chooser is available. Use the default or quit. 13 + if {[file exists $link_path]} { 14 + set answer [tk_messageBox \ 15 + -type yesno \ 16 + -title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \ 17 + -default yes \ 18 + -message [mc "Replace existing shortcut: %s?" $link_file]] 19 + if {$answer == no} { 20 + return 25 21 } 22 + } 23 + 24 + # Use git-gui.exe if found, fall back to wish + launcher 25 + set link_arguments {} 26 + set link_target [safe_exec [list cygpath -m /cmd/git-gui.exe]] 27 + if {![file executable $link_target]} { 28 + set link_target [_which git-gui] 29 + } 30 + if {![file executable $link_target]} { 31 + set link_target [file normalize [info nameofexecutable]] 32 + set link_arguments [file normalize $::argv0] 33 + } 34 + set cmdLine [list $link_target $link_arguments] 35 + if {[catch { 36 + win32_create_lnk $link_path $cmdLine \ 37 + [file normalize $_gitworktree] 38 + } err]} { 39 + error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"] 26 40 } 27 41 } 28 42
+2 -10
windows/git-gui.sh
··· 13 13 incr argc -2 14 14 } 15 15 16 - set basedir [file dirname \ 17 - [file dirname \ 18 - [file dirname [info script]]]] 19 - set bindir [file join $basedir bin] 20 - set bindir "$bindir;[file join $basedir mingw bin]" 21 - regsub -all ";" $bindir "\\;" bindir 22 - set env(PATH) "$bindir;$env(PATH)" 23 - unset bindir 24 - 25 - source [file join [file dirname [info script]] git-gui.tcl] 16 + set thisdir [file normalize [file dirname [info script]]] 17 + source [file join $thisdir git-gui.tcl]