@matheusbsbs / matheus-bagliano / commits / 6fcca938b0
Fork 0

Use $GITPERLLIB instead of $RUNNING_GIT_TESTS and centralize @INC munging

This makes the Git perl scripts check $GITPERLLIB instead of $RUNNING_GIT_TESTS, which makes more sense if you are setting up your shell environment to use a non-installed Git instance. It also weeds out the @INC munging from the individual scripts and makes Makefile add it during the .perl files processing, so that we can change just a single place when we modify this shared logic. It looks ugly in the scripts, too. ;-) And instead of doing arcane things with the @INC array, we just do 'use lib' instead, which is essentialy the same thing anyway. I first want to do three separate patches but it turned out that it's quite a lot neater when bundled together, so I hope it's ok. Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>

Petr Baudis committed Jul 3, 2006 at 23:16 UTC 6fcca938b05c33bcd8b502d6b6f178e377609fa3
5 files changed +7 -16
INSTALL
+2 -2
@@ -39,8 +39,8 @@ Issues of note:
39
40 GIT_EXEC_PATH=`pwd`
41 PATH=`pwd`:$PATH
42 - PERL5LIB=`pwd`/perl/blib/lib:`pwd`/perl/blib/arch/auto/Git
43 - export GIT_EXEC_PATH PATH PERL5LIB
42 + GITPERLLIB=`pwd`/perl/blib/lib:`pwd`/perl/blib/arch/auto/Git
43 + export GIT_EXEC_PATH PATH GITPERLLIB
44
45 - Git is reasonably self-sufficient, but does depend on a few external
46 programs and libraries:
Makefile
+3 -1
@@ -550,7 +550,9 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/Makefile
550 $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
551 rm -f $@ $@+
552 INSTLIBDIR=`$(MAKE) -C perl -s --no-print-directory instlibdir` && \
553 - sed -e '1s|#!.*perl\(.*\)|#!$(PERL_PATH_SQ)\1|' \
553 + sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|1' \
554 + -e '2i\
555 + use lib (split(/:/, $$ENV{GITPERLLIB} || '\'"$$INSTLIBDIR"\''));' \
556 -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
557 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
558 $@.perl >$@+
git-fmt-merge-msg.perl
-5
@@ -5,11 +5,6 @@
5 # Read .git/FETCH_HEAD and make a human readable merge message
6 # by grouping branches and tags together to form a single line.
7
8 -BEGIN {
9 - unless (exists $ENV{'RUNNING_GIT_TESTS'}) {
10 - unshift @INC, '@@INSTLIBDIR@@';
11 - }
12 -}
8 use strict;
9 use Git;
10 use Error qw(:try);
git-mv.perl
-5
@@ -6,11 +6,6 @@
6 # This file is licensed under the GPL v2, or a later version
7 # at the discretion of Linus Torvalds.
8
9 -BEGIN {
10 - unless (exists $ENV{'RUNNING_GIT_TESTS'}) {
11 - unshift @INC, '@@INSTLIBDIR@@';
12 - }
13 -}
9 use warnings;
10 use strict;
11 use Getopt::Std;
t/test-lib.sh
+2 -3
@@ -206,9 +206,8 @@ PYTHON=`sed -e '1{
206 PYTHONPATH=$(pwd)/../compat
207 export PYTHONPATH
208 }
209 -RUNNING_GIT_TESTS=YesWeAre
210 -PERL5LIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git
211 -export PERL5LIB RUNNING_GIT_TESTS
209 +GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git
210 +export GITPERLLIB
211 test -d ../templates/blt || {
212 error "You haven't built things yet, have you?"
213 }