Skip to contentSkip to conversation

git-gui: Make git-gui lib dir configurable at runtime

PATCH Applied David Turner 3 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-gui: Make git-gui lib dir configurable at runtime

Introduce the GIT_GUI_LIB_DIR environment variable, to tell git-gui where to look for TCL libs. This allows a git-gui which has been built with a prefix of /foo to be run out of directory /bar. This is the equivalent of GIT_EXEC_PATH or GITPERLLIB but for git-gui's TCL libraries.

---
 git-gui/Makefile   | 3 ++-
 git-gui/git-gui.sh | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
git-gui/Makefile +2 -1
index cde8b2e..56bf9e2 100644
@@ -177,7 +177,8 @@ git-gui: GIT-VERSION-FILE GIT-GUI-VARS
 	echo then >>$@+ && \
 	echo '	'echo \'git-gui version '$(GITGUI_VERSION)'\' >>$@+ && \
 	echo else >>$@+ && \
-	echo '	'exec \''$(libdir_SQ)/Git Gui.app/Contents/MacOS/$(subst \,,$(TKEXECUTABLE))'\' \
+	echo '	libdir="$$(GIT_GUI_LIB_DIR:-$(libdir_SQ))"' >>$@+ && \
+	echo '	'exec \"'$$libdir/Git Gui.app/Contents/MacOS/$(subst \,,$(TKEXECUTABLE))'\" \
 		'"$$0" "$$@"' >>$@+ && \
 	echo fi >>$@+ && \
 	chmod +x $@+ && \
git-gui/git-gui.sh +5 -1
index b186329..6cbb36e 100755
@@ -49,7 +49,11 @@ catch {rename send {}} ; # What an evil concept...
 ##
 ## locate our library
 
-set oguilib {@@GITGUI_LIBDIR@@}
+if { [info exists ::env(GIT_GUI_LIB_DIR) ] } {
+	set oguilib $::env(GIT_GUI_LIB_DIR)
+} else {
+	set oguilib {@@GITGUI_LIBDIR@@}
+}
 set oguirel {@@GITGUI_RELATIVE@@}
 if {$oguirel eq {1}} {
 	set oguilib [file dirname [file normalize $argv0]]
Signature · 1 line
1.9.1
#1 lore raw
Quoted 11 lines · David Turner

Introduce the GIT_GUI_LIB_DIR environment variable, to tell git-gui where to look for TCL libs. This allows a git-gui which has been built with a prefix of /foo to be run out of directory /bar. This is the equivalent of GIT_EXEC_PATH or GITPERLLIB but for git-gui's TCL libraries.

---
 git-gui/Makefile   | 3 ++-
 git-gui/git-gui.sh | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

Would a similar change to gitk necessary/beneficial to platforms that would benefit from this change?

git-gui directory in my tree comes from its upstream repository
git://repo.or.cz/git-gui.git/, and it is maintained by Pat Thoyts (Cc'ed).

gitk is from git://ozlabs.org/~paulus/gitk.git maintained by Paul Mackerras <[email protected]> (not Cc'ed).

Note that these two upstream projects do not have leading directories git-gui and gitk-git themselves (they are merged to my tree while their paths being renamed). A patch that is appliable to them would touch paths without them (e.g. Makefile and git-gui.sh for an equivalent of the patch I am responding to).

Thanks.

Quoted 31 lines
git-gui/Makefile +2 -1
index cde8b2e..56bf9e2 100644
@@ -177,7 +177,8 @@ git-gui: GIT-VERSION-FILE GIT-GUI-VARS
 	echo then >>$@+ && \
 	echo '	'echo \'git-gui version '$(GITGUI_VERSION)'\' >>$@+ && \
 	echo else >>$@+ && \
-	echo '	'exec \''$(libdir_SQ)/Git Gui.app/Contents/MacOS/$(subst \,,$(TKEXECUTABLE))'\' \
+	echo '	libdir="$$(GIT_GUI_LIB_DIR:-$(libdir_SQ))"' >>$@+ && \
+	echo '	'exec \"'$$libdir/Git Gui.app/Contents/MacOS/$(subst \,,$(TKEXECUTABLE))'\" \
 		'"$$0" "$$@"' >>$@+ && \
 	echo fi >>$@+ && \
 	chmod +x $@+ && \
git-gui/git-gui.sh +5 -1
index b186329..6cbb36e 100755
@@ -49,7 +49,11 @@ catch {rename send {}} ; # What an evil concept...
 ##
 ## locate our library
 
-set oguilib {@@GITGUI_LIBDIR@@}
+if { [info exists ::env(GIT_GUI_LIB_DIR) ] } {
+	set oguilib $::env(GIT_GUI_LIB_DIR)
+} else {
+	set oguilib {@@GITGUI_LIBDIR@@}
+}
 set oguirel {@@GITGUI_RELATIVE@@}
 if {$oguirel eq {1}} {
 	set oguilib [file dirname [file normalize $argv0]]
#2 lore raw
Quoted 8 lines · Junio C Hamano
Quoted 6 lines · David Turner

Introduce the GIT_GUI_LIB_DIR environment variable, to tell git-gui where to look for TCL libs. This allows a git-gui which has been built with a prefix of /foo to be run out of directory /bar. This is the equivalent of GIT_EXEC_PATH or GITPERLLIB but for git-gui's TCL libraries.

Quoted 8 lines
Quoted 5 lines
---
 git-gui/Makefile   | 3 ++-
 git-gui/git-gui.sh | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

Would a similar change to gitk necessary/beneficial to platforms that would benefit from this change?

Apparently not; it seems to work fine for me from an alternate location. Convenient!

Quoted 9 lines

git-gui directory in my tree comes from its upstream repository
git://repo.or.cz/git-gui.git/, and it is maintained by Pat Thoyts (Cc'ed).

Note that these two upstream projects do not have leading directories git-gui and gitk-git themselves (they are merged to my tree while their paths being renamed). A patch that is appliable to them would touch paths without them (e.g. Makefile and git-gui.sh for an equivalent of the patch I am responding to).

Pat, do you want patches via the git mailing list, personal mail, or some other way?

Applied
#3 lore raw
Quoted 25 lines · David Turner
Quoted 8 lines · Junio C Hamano
Quoted 6 lines · David Turner

Introduce the GIT_GUI_LIB_DIR environment variable, to tell git-gui where to look for TCL libs. This allows a git-gui which has been built with a prefix of /foo to be run out of directory /bar. This is the equivalent of GIT_EXEC_PATH or GITPERLLIB but for git-gui's TCL libraries.

Quoted 8 lines
Quoted 5 lines
---
 git-gui/Makefile   | 3 ++-
 git-gui/git-gui.sh | 6 +++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

Would a similar change to gitk necessary/beneficial to platforms that would benefit from this change?

Apparently not; it seems to work fine for me from an alternate location. Convenient!

Quoted 3 lines

git-gui directory in my tree comes from its upstream repository
git://repo.or.cz/git-gui.git/, and it is maintained by Pat Thoyts (Cc'ed).

Quoted 9 lines
Quoted 5 lines

Note that these two upstream projects do not have leading directories git-gui and gitk-git themselves (they are merged to my tree while their paths being renamed). A patch that is appliable to them would touch paths without them (e.g. Makefile and git-gui.sh for an equivalent of the patch I am responding to).

Pat, do you want patches via the git mailing list, personal mail, or some other way?

The standard method is both: personal to ensure I see it and mailing list to allow everyone to comment.

I've applied this patch to git-gui master.

Signature · 2 lines
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD
#4 lore raw
Quoted 8 lines · Pat Thoyts
Quoted 3 lines

Pat, do you want patches via the git mailing list, personal mail, or some other way?

The standard method is both: personal to ensure I see it and mailing list to allow everyone to comment.

I've applied this patch to git-gui master.

Thanks, both. Is it a good time to pull the changes from you to be in the final 2.1 release?