From 306fc124621657234b21dce542496440d53147a6 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 22 May 2007 03:22:51 -0400 Subject: git-gui: Tighten internal pattern match for lib/ directory Our GITGUI_LIBDIR macro was testing only for @@ at the start of the path, assuming nobody would ever find that to be a reasonable prefix for a directory to install our library into. That is most likely a valid assumption, but its even more unlikely they would have the start be @@GITGUI_ and the end be @@. Note that we cannot use the full string here because that would get expanded by the sed replacement in our Makefile. Signed-off-by: Shawn O. Pearce --- git-gui.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-gui.sh b/git-gui.sh index 0a471a5c7..40f54e4da 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA} ## configure our library set oguilib {@@GITGUI_LIBDIR@@} -if {[string match @@* $oguilib]} { +if {[string match @@GITGUI_*@@ $oguilib]} { set oguilib [file join [file dirname [file normalize $argv0]] lib] } set idx [file join $oguilib tclIndex] -- cgit v1.2.1 From 3d5793bf52223ccec40aff2839a3c5bad96bca8b Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 24 May 2007 02:33:13 -0400 Subject: Correct key bindings to Control- Alberto Bertogli reported on #git that git-gui was exiting with alt-q, while gitk on the same system was exiting with ctrl-q. That was not what I wanted. I really wanted M1B to be bound to the Control key on most non-Mac OS X platforms, but according to Sam Vilain M1 on most systems means alt. Since gitk always does control, I'm doing the same thing for all non-Mac OS X systems. Signed-off-by: Shawn O. Pearce --- git-gui.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/git-gui.sh b/git-gui.sh index 40f54e4da..cfc4c7f68 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1206,15 +1206,12 @@ foreach class {Button Checkbutton Entry Label } unset class -if {[is_Windows]} { - set M1B Control - set M1T Ctrl -} elseif {[is_MacOSX]} { +if {[is_MacOSX]} { set M1B M1 set M1T Cmd } else { - set M1B M1 - set M1T M1 + set M1B Control + set M1T Ctrl } proc apply_config {} { -- cgit v1.2.1 From ea75ee3598ab6f8d0828f8cc6ec3d4a5f8d66813 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sun, 27 May 2007 00:03:37 -0400 Subject: git-gui: Guess our share/git-gui/lib path at runtime if possible Johannes Sixt asked me to try to avoid embedding the runtime location of git-gui's library directory in the executable script. Not embedding it helps the MinGW to be relocatable to another directory should a user wish to install the programs in a directory other than the location the packager wanted them to be installed into. Most of this is a hack. We try to determine if the path of our master git-gui script will be able to locate the lib by ../share/git-gui/lib. This should be true if $(gitexecdir) and $(libdir) have the same prefix. If they do then we defer the assignment of $(libdir) until runtime, and we get it from $argv0 rather than embedding it into the script itself. Signed-off-by: Shawn O. Pearce --- Makefile | 12 ++++++++++-- git-gui.sh | 8 ++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index ee564219c..3de0de1a2 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ ifndef gitexecdir endif ifndef sharedir - sharedir := $(dir $(gitexecdir))/share + sharedir := $(dir $(gitexecdir))share endif ifndef INSTALL @@ -53,12 +53,19 @@ TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH)) libdir ?= $(sharedir)/git-gui/lib libdir_SQ = $(subst ','\'',$(libdir)) +exedir = $(dir $(gitexecdir))share/git-gui/lib +exedir_SQ = $(subst ','\'',$(exedir)) + $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh $(QUIET_GEN)rm -f $@ $@+ && \ + if test '$(exedir_SQ)' = '$(libdir_SQ)'; then \ + GITGUI_RELATIVE=1; \ + fi && \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|^exec wish "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' \ -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \ - -e 's|@@GITGUI_LIBDIR@@|$(libdir_SQ)|' \ + -e 's|@@GITGUI_RELATIVE@@|'$$GITGUI_RELATIVE'|' \ + -e $$GITGUI_RELATIVE's|@@GITGUI_LIBDIR@@|$(libdir_SQ)|' \ $@.sh >$@+ && \ chmod +x $@+ && \ mv $@+ $@ @@ -88,6 +95,7 @@ TRACK_VARS = \ $(subst ','\'',SHELL_PATH='$(SHELL_PATH_SQ)') \ $(subst ','\'',TCL_PATH='$(TCL_PATH_SQ)') \ $(subst ','\'',TCLTK_PATH='$(TCLTK_PATH_SQ)') \ + $(subst ','\'',gitexecdir='$(gitexecdir_SQ)') \ $(subst ','\'',libdir='$(libdir_SQ)') \ #end TRACK_VARS diff --git a/git-gui.sh b/git-gui.sh index cfc4c7f68..dba585111 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -25,7 +25,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA} ## configure our library set oguilib {@@GITGUI_LIBDIR@@} -if {[string match @@GITGUI_*@@ $oguilib]} { +set oguirel {@@GITGUI_RELATIVE@@} +if {$oguirel eq {1}} { + set oguilib [file dirname [file dirname [file normalize $argv0]]] + set oguilib [file join $oguilib share git-gui lib] +} elseif {[string match @@* $oguirel]} { set oguilib [file join [file dirname [file normalize $argv0]] lib] } set idx [file join $oguilib tclIndex] @@ -55,7 +59,7 @@ if {$idx ne {}} { } else { set auto_path [concat [list $oguilib] $auto_path] } -unset -nocomplain fd idx +unset -nocomplain oguilib oguirel idx fd if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} { unset _verbose -- cgit v1.2.1