diff options
author | Bram <perl-rt@wizbit.be> | 2022-08-20 15:40:37 +0200 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2022-08-22 10:35:38 -0600 |
commit | a1e3603d9bc6dda037cac0f2d3dc1dbf59bdf06f (patch) | |
tree | f04397aa6ac3e17ea72f1dc51fed4a74e7fcf37c /t/porting | |
parent | 7acf0ac17ca540bf99553846c501101ee8ea9d28 (diff) | |
download | perl-a1e3603d9bc6dda037cac0f2d3dc1dbf59bdf06f.tar.gz |
Skip t/porting/authors.t on shallow clones
On shallow clones the history is not available.
Before:
The 'are we on a branch' logic was broken which caused this
test to assume it was always on a branch which caused it to
use: `git log HEAD^1..HEAD^2` | perl Porting/checkAUTHORS.pl --tap`.
That `git log` command returns *no commits* when HEAD is *not* a branch
and then the test passes.
In a shallow clone (clone without history) there is only one commit and
never a merge so this test silently did nothing on a shallow clone.
Intermediate:
In commit 16dd3f70cc16005d5af7146385733a7c945fb67e the 'are we on a branch'
logic was fixed and now it does do the right thing.
But this introduces a new problem: on a shallow clone there is no history
so there never is a merge commit. But GitHub Actions does *add* a merge
commit (in some cases) with a different author/committer name/emailaddress
(one which should not be in AUTHORS).
Result: the GitHub CI *failed* because they're using shallow clones.
Now:
When a shallow clone is detected just skip the entire test.
Before it already did that (by accident) now make this explicit.
Example git log:
my branch for which a PR was created:
$ git log --format=format:"%h %aN <%aE> - %s" --graph -n25
* 12a6316 Bram <perl-rt@wizbit.be> - TMP: Add some temporary debugging
* 8ac37a5 Bram <perl-rt@wizbit.be> - CI: Special case porting test in 'sanity check'
* 7f36725 Karl Williamson <khw@cpan.org> - makedef: Export certain symbols
GitHub CI with full git history (i.e. no shallow clone):
$ git log --format=format:"%h %aN <%aE> - %s" --graph -n25
* 99884eedeb Bram <109858694+bram-perl@users.noreply.github.com> - Merge 12a6316de1a8834f07d76c59480bafc3fdfa0c66 into 7f367253e335e8507638bb2ca1767c0fedbc95d3
|\
| * 12a6316de1 Bram <perl-rt@wizbit.be> - TMP: Add some temporary debugging
| * 8ac37a5a03 Bram <perl-rt@wizbit.be> - CI: Special case porting test in 'sanity check'
|/
* 7f367253e3 Karl Williamson <khw@cpan.org> - makedef: Export certain symbols
GitHub CI without history (i.e. shallow clone):
$ git log --format=format:"%h %aN <%aE> - %s" --graph -n25
* 99884eede Bram <109858694+bram-perl@users.noreply.github.com> - Merge 12a6316de1a8834f07d76c59480bafc3fdfa0c66 into 7f367253e335e8507638bb2ca1767c0fedbc95d3
For future reference: the git show info:
commit 99884eedebb6cccd1596023a94e32eb3aea6f5e8
Author: Bram <109858694+bram-perl@users.noreply.github.com>
Commit: GitHub <noreply@github.com>
(I do *not* have that Author email-address configured)
Diffstat (limited to 't/porting')
-rw-r--r-- | t/porting/authors.t | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/t/porting/authors.t b/t/porting/authors.t index ffe8f636ec..667b38a480 100644 --- a/t/porting/authors.t +++ b/t/porting/authors.t @@ -10,11 +10,15 @@ BEGIN { use TestInit qw(T); # T is chdir to the top level use strict; -find_git_or_skip('all'); +my $source_dir = find_git_or_skip('all'); skip_all( "This distro may have modified some files in cpan/. Skipping validation.") if $ENV{'PERL_BUILD_PACKAGING'}; +skip_all( + "This is a shallow clone, this test requires history.") + if (-e "$source_dir/.git/shallow"); + my $revision_range = ''; # could use 'v5.22.0..' as default, no reason to recheck all previous commits... if ( $ENV{TRAVIS} && defined $ENV{TRAVIS_COMMIT_RANGE} ) { # travisci is adding a merge commit when smoking a pull request |