@matheusbsbs / matheus-bagliano / commits / 501e4c6f23
Fork 0

git-gui: Allow gitk to be started on Cygwin with native Tcl/Tk

gitk expects $env(GIT_DIR) to be valid as both a path that core Git and Tcl/Tk can resolve to a valid directory, but it has no special handling for Cygwin style UNIX paths and Windows style paths. So we need to do that for gitk and ensure that only relative paths are fed to it, thus allowing both Cygwin style and UNIX style paths to be resolved. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Oct 2, 2007 at 12:24 UTC 501e4c6f23378aca2ce14ba4bc3eebeccb92e8d7
1 file changed +20
git-gui.sh
+20
@@ -1468,7 +1468,27 @@ proc do_gitk {revs} {
1468 if {! [file exists $exe]} {
1469 error_popup "Unable to start gitk:\n\n$exe does not exist"
1470 } else {
1471 + global env
1472 +
1473 + if {[info exists env(GIT_DIR)]} {
1474 + set old_GIT_DIR $env(GIT_DIR)
1475 + } else {
1476 + set old_GIT_DIR {}
1477 + }
1478 +
1479 + set pwd [pwd]
1480 + cd [file dirname [gitdir]]
1481 + set env(GIT_DIR) [file tail [gitdir]]
1482 +
1483 eval exec $cmd $revs &
1484 +
1485 + if {$old_GIT_DIR eq {}} {
1486 + unset env(GIT_DIR)
1487 + } else {
1488 + set env(GIT_DIR) $old_GIT_DIR
1489 + }
1490 + cd $pwd
1491 +
1492 ui_status $::starting_gitk_msg
1493 after 10000 {
1494 ui_ready $starting_gitk_msg