summaryrefslogtreecommitdiff
path: root/git-gui.sh
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-10-02 16:24:44 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-10-03 04:14:18 (GMT)
commit501e4c6f23378aca2ce14ba4bc3eebeccb92e8d7 (patch)
treef8e2b9b3b9305f0df7b5441a779e6154dfc37249 /git-gui.sh
parent2fe167b67a479b19e52b974f9518436565e6793b (diff)
downloadgit-501e4c6f23378aca2ce14ba4bc3eebeccb92e8d7.zip
git-501e4c6f23378aca2ce14ba4bc3eebeccb92e8d7.tar.gz
git-501e4c6f23378aca2ce14ba4bc3eebeccb92e8d7.tar.bz2
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>
Diffstat (limited to 'git-gui.sh')
-rwxr-xr-xgit-gui.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/git-gui.sh b/git-gui.sh
index c837502..9682418 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