git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] test-lib.sh: set PERL5LIB instead of GITPERLLIB

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 2, 2008, 20:01 UTC
Message-ID
<7v4p8b7gij.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1212415996-32130-1-git-send-email-LeWiemann@gmail.com>
Lea Wiemann <lewiemann@gmail.com> writes:
Show 11 quoted lines
> From: Lea Wiemann <lewiemann@gmail.com>
>
> By setting PERL5LIB for the tests, we enable Perl test scripts to just
> say "use Git;" without adding the GITPERLLIB paths to @INC beforehand.
>
> Also, unset GITPERLLIB so that user-set paths in GETPERLLIB don't
> cause the wrong module to be loaded.
>
> Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
> ---
> Added since v1: Unset GITPERLLIB.

This goes even further in the opposite direction from the original. It looks cleaner, and I'd prefer the approach _if_ it worked.

But I do not think it does.

I think the reason we did not do this long time ago in 6fcca93 (Use $GITPERLLIB instead of $RUNNING_GIT_TESTS and centralize @INC munging, 2006-07-03) was because of the precedence between "use lib @these_paths" and $PERL5LIB does not work the way you seem to think it does.

If you say in your script:
	use lib '/usr/local/git/perl'
        use Git;

(and we do want to say so in our script to make sure that people can install Git.pm outside of system install paths), running the script with PERL5LIB set to elsewhere that has Git.pm would not help.

I just tried:
	$ pwd
        /net/knick/home/junio/junk/
	$ cat j.perl
        #!/usr/bin/perl -w
        use lib '/net/knick/home/junio/junk/1dir';
        use G;
        print $G::it;
        $ cat 1dir/G.pm
        package G;
        our $it = 1;
        1;
        $ cat 2dir/G.pm
        package G;
        our $it = 2;
        1;
        $ perl -w j.perl
        1
        $ PERL5LIB=/net/knick/home/junio/junk/2dir perl -w j.perl
        1

Because "t/t9700/<many>.perl" will _not_ be installed anyway, I do not think they need to be "built" like the scripted Porcelain commands. If they unconditionally do "use lib $ENV{GITPERLLIB};" upfront, wouldn't that be enough to guarantee that you would use the freshly built one during the test, not the instsalled one?

Previous: Lea WiemannNext: Lea Wiemann
Message 20 of 23 in “gitweb: use Git.pm, and use its parse_rev method for git_get_head_hash”
  1. gitweb: use Git.pm, and use its parse_rev method for git_get_head_hashLea Wiemann, May 30, 2008
  2. Lea WiemannMay 30, 2008
  3. Jakub NarebskiMay 31, 2008
  4. Lea WiemannMay 31, 2008
  5. Jakub NarebskiJun 1, 2008
  6. Junio C HamanoJun 2, 2008
  7. Petr BaudisJun 2, 2008
  8. Jakub NarebskiJun 2, 2008
  9. Lea WiemannJun 2, 2008
  10. Petr BaudisMay 31, 2008
  11. gitweb: use Git.pm, and use its parse_rev method for git_get_head_hashLea Wiemann, May 31, 2008
  12. Lea WiemannMay 31, 2008
  13. Junio C HamanoJun 1, 2008
  14. Lea WiemannJun 1, 2008
  15. Junio C HamanoJun 1, 2008
  16. test-lib.sh: set PERL5LIB instead of GITPERLLIBLea Wiemann, Jun 1, 2008
  17. Junio C HamanoJun 2, 2008
  18. Lea WiemannJun 2, 2008
  19. test-lib.sh: set PERL5LIB instead of GITPERLLIBLea Wiemann, Jun 2, 2008
  20. Junio C HamanoJun 2, 2008
  21. Lea WiemannJun 2, 2008
  22. Lea WiemannJun 3, 2008
  23. Lea WiemannJun 1, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.