summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d6da71a)
raw | patch | inline | side by side (parent: d6da71a)
author | Shawn O. Pearce <spearce@spearce.org> | |
Thu, 17 May 2007 22:01:50 +0000 (18:01 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Thu, 17 May 2007 22:10:26 +0000 (18:10 -0400) |
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>
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>
Makefile | patch | blob | history | |
git-gui.sh | patch | blob | history |
diff --git a/Makefile b/Makefile
index e73b6453d9626cad1d2f71679afc0638f464f305..ee564219c0f911025b9bf850539b87edae2d13c4 100644 (file)
--- a/Makefile
+++ b/Makefile
GITGUI_BUILT_INS = git-citool
ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH))
ALL_LIBFILES = $(wildcard lib/*.tcl)
+PRELOAD_FILES = lib/class.tcl
ifndef SHELL_PATH
SHELL_PATH = /bin/sh
QUIET_GEN = @echo ' ' GEN $@;
QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
QUIET_INDEX = @echo ' ' INDEX $(dir $@);
+ QUIET_2DEVNULL = 2>/dev/null
endif
TCL_PATH ?= tclsh
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+TCL_PATH_SQ = $(subst ','\'',$(TCL_PATH))
TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
libdir ?= $(sharedir)/git-gui/lib
$(QUIET_BUILT_IN)rm -f $@ && ln git-gui $@
lib/tclIndex: $(ALL_LIBFILES)
- $(QUIET_INDEX)echo \
- source lib/class.tcl \; \
+ $(QUIET_INDEX)if echo \
+ $(foreach p,$(PRELOAD_FILES),source $p\;) \
auto_mkindex lib '*.tcl' \
- | $(TCL_PATH)
+ | $(TCL_PATH) $(QUIET_2DEVNULL); then : ok; \
+ else \
+ echo 1>&2 " * $(TCL_PATH) failed; using unoptimized loading"; \
+ rm -f $@ ; \
+ echo '# Autogenerated by git-gui Makefile' >$@ && \
+ echo >>$@ && \
+ $(foreach p,$(PRELOAD_FILES) $(ALL_LIBFILES),echo '$(subst lib/,,$p)' >>$@ &&) \
+ echo >>$@ ; \
+ fi
# These can record GITGUI_VERSION
$(patsubst %.sh,%,$(SCRIPT_SH)): GIT-VERSION-FILE GIT-GUI-VARS
+lib/tclIndex: GIT-GUI-VARS
TRACK_VARS = \
$(subst ','\'',SHELL_PATH='$(SHELL_PATH_SQ)') \
+ $(subst ','\'',TCL_PATH='$(TCL_PATH_SQ)') \
$(subst ','\'',TCLTK_PATH='$(TCLTK_PATH_SQ)') \
$(subst ','\'',libdir='$(libdir_SQ)') \
#end TRACK_VARS
diff --git a/git-gui.sh b/git-gui.sh
index 2fda4c229022b19c517228a2c14942dd92b06474..0a471a5c7d4a2126f1f3322424a643796e1de715 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
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