summaryrefslogtreecommitdiff
path: root/git-gui.sh
diff options
context:
space:
mode:
authorLibravatar Shawn O. Pearce <spearce@spearce.org>2007-05-17 18:01:50 -0400
committerLibravatar Shawn O. Pearce <spearce@spearce.org>2007-05-17 18:10:26 -0400
commitb9e7efb8b5f7d424466dd1ce61fd20658f60543f (patch)
treeba359fd104fe245a67d0e194c985ed49cd5ec0e5 /git-gui.sh
parentgit gui 0.7.0 (diff)
downloadtgif-b9e7efb8b5f7d424466dd1ce61fd20658f60543f.tar.xz
git-gui: Gracefully handle bad TCL_PATH at compile time
Petr Baudis pointed out the main git.git repository's Makefile dies now if git-gui 0.7.0-rc1 or later is being used and TCL_PATH was not set to a working tclsh program path. This breaks people who may have a working build configuration today and suddenly upgrade to the latest git release. The tclIndex is required for git-gui to load its associated lib files, but using the Tcl auto_load procedure to source only the files we need is a performance optimization. We can emulate the auto_load by just source'ing every file in that directory, assuming we source class.tcl first to initialize our crude class system. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui.sh')
-rwxr-xr-xgit-gui.sh29
1 files changed, 28 insertions, 1 deletions
diff --git a/git-gui.sh b/git-gui.sh
index 2fda4c2290..0a471a5c7d 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -28,7 +28,34 @@ set oguilib {@@GITGUI_LIBDIR@@}
if {[string match @@* $oguilib]} {
set oguilib [file join [file dirname [file normalize $argv0]] lib]
}
-set auto_path [concat [list $oguilib] $auto_path]
+set idx [file join $oguilib tclIndex]
+catch {
+ set fd [open $idx r]
+ if {[gets $fd] eq {# Autogenerated by git-gui Makefile}} {
+ set idx [list]
+ while {[gets $fd n] >= 0} {
+ if {$n ne {} && ![string match #* $n]} {
+ lappend idx $n
+ }
+ }
+ } else {
+ set idx {}
+ }
+ close $fd
+}
+if {$idx ne {}} {
+ set loaded [list]
+ foreach p $idx {
+ if {[lsearch -exact $loaded $p] >= 0} continue
+ puts $p
+ source [file join $oguilib $p]
+ lappend loaded $p
+ }
+ unset loaded p
+} else {
+ set auto_path [concat [list $oguilib] $auto_path]
+}
+unset -nocomplain fd idx
if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
unset _verbose