]> rtime.felk.cvut.cz Git - sojka/git-gui.git/commitdiff
git-gui: Collapse $env(HOME) to ~/ in recent repositories on Windows
authorShawn O. Pearce <spearce@spearce.org>
Fri, 12 Oct 2007 20:33:45 +0000 (16:33 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Sat, 13 Oct 2007 03:07:59 +0000 (23:07 -0400)
Apparently native Tcl/Tk on Windows is using \ as the return value
from [file separator] but [file normalize] on that same system is
using / rather than \ to represent a directory separator.  I really
think that is nuts, but its what is happening.

So we can actually just hardcode our separator to / as all systems
we support (Windows, Mac OS X, UNIX) use /.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
lib/choose_repository.tcl

index bf04361464900ae216db57e35cd8c5e563fc0476..2bac50e1493ad2b0b05b3dc0a740467dfa778ebb 100644 (file)
@@ -140,12 +140,16 @@ constructor pick {} {
                $w_recentlist tag conf link \
                        -foreground blue \
                        -underline 1
-               set home "[file normalize $::env(HOME)][file separator]"
+               set home $::env(HOME)
+               if {[is_Cygwin]} {
+                       set home [exec cygpath --windows --absolute $home]
+               }
+               set home "[file normalize $home]/"
                set hlen [string length $home]
                foreach p $sorted_recent {
                        set path $p
                        if {[string equal -length $hlen $home $p]} {
-                               set p "~[file separator][string range $p $hlen end]"
+                               set p "~/[string range $p $hlen end]"
                        }
                        regsub -all "\n" $p "\\n" p
                        $w_recentlist insert end $p link