Merge branch 'tz/cred-netrc-cleanup'
authorJunio C Hamano <gitster@pobox.com>
Thu, 28 Jun 2018 19:53:33 +0000 (12:53 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 28 Jun 2018 19:53:33 +0000 (12:53 -0700)
Build and test procedure for netrc credential helper (in contrib/)
has been updated.

* tz/cred-netrc-cleanup:
git-credential-netrc: make "all" default target of Makefile
git-credential-netrc: fix exit status when tests fail
git-credential-netrc: use in-tree Git.pm for tests
git-credential-netrc: minor whitespace cleanup in test script

contrib/credential/netrc/Makefile
contrib/credential/netrc/t-git-credential-netrc.sh
contrib/credential/netrc/test.pl
index 0ffa40719126fe285722cfa8fc7b461d0584cd3a..6174e3bb83826273f005b01f6d9e9b2093664e33 100644 (file)
@@ -1,3 +1,6 @@
+# The default target of this Makefile is...
+all::
+
 test:
        ./t-git-credential-netrc.sh
 
index 58191a62f8623642d4bf1f2af50130132d529fb3..07227d02287618394d649ae915a1b42d93140950 100755 (executable)
        # set up test repository
 
        test_expect_success \
-    'set up test repository' \
-    'git config --add gpg.program test.git-config-gpg'
+               'set up test repository' \
+               'git config --add gpg.program test.git-config-gpg'
 
        # The external test will outputs its own plan
        test_external_has_tap=1
 
+       export PERL5LIB="$GITPERLLIB"
        test_external \
-    'git-credential-netrc' \
-    perl "$TEST_DIRECTORY"/../contrib/credential/netrc/test.pl
+               'git-credential-netrc' \
+               perl "$GIT_BUILD_DIR"/contrib/credential/netrc/test.pl
 
        test_done
 )
index 1e1001030e7631dd49cbfeb002b429158019f191..c0fb3718b280c70316941de7617871360b724525 100755 (executable)
@@ -1,5 +1,4 @@
 #!/usr/bin/perl
-use lib (split(/:/, $ENV{GITPERLLIB}));
 
 use warnings;
 use strict;
@@ -12,7 +11,6 @@ BEGIN
        # t-git-credential-netrc.sh kicks off our testing, so we have to go
        # from there.
        Test::More->builder->current_test(1);
-       Test::More->builder->no_ending(1);
 }
 
 my @global_credential_args = @ARGV;
@@ -104,6 +102,9 @@ BEGIN
 
 ok(scalar keys %$cred == 2, 'Got keys decrypted by command option');
 
+my $is_passing = eval { Test::More->is_passing };
+exit($is_passing ? 0 : 1) unless $@ =~ /Can't locate object method/;
+
 sub run_credential
 {
        my $args = shift @_;