From 501e4c6f23378aca2ce14ba4bc3eebeccb92e8d7 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 2 Oct 2007 12:24:44 -0400 Subject: [PATCH 1/2] 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 --- git-gui.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/git-gui.sh b/git-gui.sh index c8375029dd..9682418e12 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1468,7 +1468,27 @@ proc do_gitk {revs} { if {! [file exists $exe]} { error_popup "Unable to start gitk:\n\n$exe does not exist" } else { + global env + + if {[info exists env(GIT_DIR)]} { + set old_GIT_DIR $env(GIT_DIR) + } else { + set old_GIT_DIR {} + } + + set pwd [pwd] + cd [file dirname [gitdir]] + set env(GIT_DIR) [file tail [gitdir]] + eval exec $cmd $revs & + + if {$old_GIT_DIR eq {}} { + unset env(GIT_DIR) + } else { + set env(GIT_DIR) $old_GIT_DIR + } + cd $pwd + ui_status $::starting_gitk_msg after 10000 { ui_ready $starting_gitk_msg From 906ab7f6c03764423adef6c0e4d77442405adc23 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 2 Oct 2007 12:27:32 -0400 Subject: [PATCH 2/2] git-gui: Don't crash when starting gitk from a browser session If the user has started git-gui from the command line as a browser we offer the gitk menu options but we didn't create the main status bar widget in the "." toplevel. Trying to access it while starting gitk just results in Tcl errors. Signed-off-by: Shawn O. Pearce --- git-gui.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/git-gui.sh b/git-gui.sh index 9682418e12..cf88a0d824 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1125,11 +1125,17 @@ proc mapdesc {state path} { } proc ui_status {msg} { - $::main_status show $msg + global main_status + if {[info exists main_status]} { + $main_status show $msg + } } proc ui_ready {{test {}}} { - $::main_status show {Ready.} $test + global main_status + if {[info exists main_status]} { + $main_status show [mc "Ready."] $test + } } proc escape_path {path} {