Skip to content

Commit

Permalink
Use $GITPERLLIB instead of $RUNNING_GIT_TESTS and centralize @inc mun…
Browse files Browse the repository at this point in the history
…ging

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 <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
Petr Baudis authored and Junio C Hamano committed Jul 4, 2006
1 parent 3c767a0 commit 6fcca93
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 16 deletions.
4 changes: 2 additions & 2 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ Issues of note:

GIT_EXEC_PATH=`pwd`
PATH=`pwd`:$PATH
PERL5LIB=`pwd`/perl/blib/lib:`pwd`/perl/blib/arch/auto/Git
export GIT_EXEC_PATH PATH PERL5LIB
GITPERLLIB=`pwd`/perl/blib/lib:`pwd`/perl/blib/arch/auto/Git
export GIT_EXEC_PATH PATH GITPERLLIB

- Git is reasonably self-sufficient, but does depend on a few external
programs and libraries:
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,9 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/Makefile
$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
rm -f $@ $@+
INSTLIBDIR=`$(MAKE) -C perl -s --no-print-directory instlibdir` && \
sed -e '1s|#!.*perl\(.*\)|#!$(PERL_PATH_SQ)\1|' \
sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|1' \
-e '2i\
use lib (split(/:/, $$ENV{GITPERLLIB} || '\'"$$INSTLIBDIR"\''));' \
-e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
$@.perl >$@+
Expand Down
5 changes: 0 additions & 5 deletions git-fmt-merge-msg.perl
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
# Read .git/FETCH_HEAD and make a human readable merge message
# by grouping branches and tags together to form a single line.

BEGIN {
unless (exists $ENV{'RUNNING_GIT_TESTS'}) {
unshift @INC, '@@INSTLIBDIR@@';
}
}
use strict;
use Git;
use Error qw(:try);
Expand Down
5 changes: 0 additions & 5 deletions git-mv.perl
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
# This file is licensed under the GPL v2, or a later version
# at the discretion of Linus Torvalds.

BEGIN {
unless (exists $ENV{'RUNNING_GIT_TESTS'}) {
unshift @INC, '@@INSTLIBDIR@@';
}
}
use warnings;
use strict;
use Getopt::Std;
Expand Down
5 changes: 2 additions & 3 deletions t/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,8 @@ PYTHON=`sed -e '1{
PYTHONPATH=$(pwd)/../compat
export PYTHONPATH
}
RUNNING_GIT_TESTS=YesWeAre
PERL5LIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git
export PERL5LIB RUNNING_GIT_TESTS
GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git
export GITPERLLIB
test -d ../templates/blt || {
error "You haven't built things yet, have you?"
}
Expand Down

0 comments on commit 6fcca93

Please sign in to comment.