| 1 | 30 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | package Git::Hooks::CheckCommit; | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # ABSTRACT: Git::Hooks plugin to enforce commit policies | ||||||||||||||||||||||||||||||||||||||||||
| 5 | 30 | $Git::Hooks::CheckCommit::VERSION = '4.0.0'; | |||||||||||||||||||||||||||||||||||||||||
| 6 | 30 | ▶ | use v5.30.0; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 30 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 30 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 30 | ▶ | use Log::Any '$log'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 30 | ▶ | use Git::Hooks; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 30 | ▶ | use Git::Repository::Log; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 30 | ▶ | use List::MoreUtils qw/any none/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 30 | my $PKG = __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||
| 15 | 30 | my $CFG = __PACKAGE__ =~ s/.*::/githooks./r; | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | ############# | ||||||||||||||||||||||||||||||||||||||||||
| 18 | # Grok hook configuration, check it and set defaults. | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 30 | ▶ | sub _setup_config { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_setup_config: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 30 | my ($git) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 30 | my $config = $git->get_config(); | |||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 30 | ▶ | $config->{lc $CFG} //= {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$$config{lc $CFG} //= {}
MC/DC100%1/1
$$config{lc $CFG} //= {}
$$config{lc $CFG}
Truth table100%2/2
A
A= $$config{lc $CFG}
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 30 | my $default = $config->{lc $CFG}; | |||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 30 | ▶ | $default->{'push-limit'} //= [0]; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$default->{"push-limit"} //= [0]
MC/DC100%1/1
$default->{"push-limit"} //= [0]
$default->{"push-limit"}
Truth table100%2/2
A
A= $default->{"push-limit"}
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 30 | return; | |||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | ########## | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | # Return common help messages to fix author or committer name/email. This | ||||||||||||||||||||||||||||||||||||||||||
| 37 | # routine is used to compose some error messages in the routine match_errors | ||||||||||||||||||||||||||||||||||||||||||
| 38 | # below. The "no critic" exemption below is a false positive. | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 24 | ▶ | sub _amend_help { ## no critic (ProhibitUnusedPrivateSubroutines) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_amend_help: called CC=3 SCAR=11.3
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 24 | my ($who) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 41 | 24 | ▶ | if ($who eq 'author') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 12 | return 'Please, amend your commit using the --author option to fix the author name/email.'; | |||||||||||||||||||||||||||||||||||||||||
| 43 | } elsif ($who eq 'committer') { | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 12 | return 'Please, amend your commit after fixing your user.name and/or user.email configuration options.'; | |||||||||||||||||||||||||||||||||||||||||
| 45 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | croak "Internal error: invalid who ($who)"; | |||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 35 | ▶ | sub match_errors { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
match_errors: called CC=10 SCAR=23.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 35 | my ($git, $commit) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 35 | my $errors = 0; | |||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 35 | my $cache = $git->cache($PKG); | |||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 35 | ▶ | unless (exists $cache->{identity}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 28 | $cache->{identity} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 28 | foreach my $info (qw/name email/) { | |||||||||||||||||||||||||||||||||||||||||
| 60 | 56 | foreach my $regexp ($git->get_config($CFG => $info)) { | |||||||||||||||||||||||||||||||||||||||||
| 61 | 24 | $regexp =~ s/^(\!?)//; | |||||||||||||||||||||||||||||||||||||||||
| 62 | 24 | push $cache->{identity}{$info}{$1}->@*, qr/$regexp/; ## no critic (ProhibitCaptureWithoutTest) | |||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 35 | ▶ | if (keys $cache->{identity}->%*) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 12 | foreach my $info (qw/name email/) { | |||||||||||||||||||||||||||||||||||||||||
| 69 | 24 | ▶ | if (my $checks = $cache->{identity}{$info}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 12 | foreach my $who (qw/author committer/) { | |||||||||||||||||||||||||||||||||||||||||
| 71 | 24 | my $who_info = "${who}_${info}"; | |||||||||||||||||||||||||||||||||||||||||
| 72 | 24 | my $data = $commit->$who_info; | |||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | 24 | ▶ | if (none { $data =~ $_ } $checks->{''}->@*) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 14 | $git->fault(<<"EOS", {commit => $commit, option => $info}); | |||||||||||||||||||||||||||||||||||||||||
| 76 | The commit $who $info ($data) is invalid. | ||||||||||||||||||||||||||||||||||||||||||
| 77 | It must match at least one positive option. | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 14 | @{[_amend_help($who)]} | |||||||||||||||||||||||||||||||||||||||||
| 79 | EOS | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 14 | ++$errors; | |||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 24 | ▶ | if (any { $data =~ $_ } $checks->{'!'}->@*) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | 4 | $git->fault(<<"EOS", {commit => $commit, option => $info}); | |||||||||||||||||||||||||||||||||||||||||
| 85 | The commit $who $info ($data) is invalid. | ||||||||||||||||||||||||||||||||||||||||||
| 86 | It matches some negative option. | ||||||||||||||||||||||||||||||||||||||||||
| 87 | 4 | @{[_amend_help($who)]} | |||||||||||||||||||||||||||||||||||||||||
| 88 | EOS | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 4 | ++$errors; | |||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 35 | return $errors; | |||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | 17 | ▶ | sub merge_errors { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
merge_errors: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 17 | my ($git, $commit) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | 17 | ▶ | if ($commit->parent() > 1) { # it's a merge commit | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 4 | ▶ | if (my @mergers = $git->get_config($CFG => 'merger')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 3 | ▶ | if (none {$git->match_user($_)} @mergers) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 1 | $git->fault(<<"EOS", {commit => $commit, option => 'merger'}); | |||||||||||||||||||||||||||||||||||||||||
| 106 | Authorization error: you cannot push this commit. | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 1 | I'm sorry, but you (@{[$git->authenticated_user]}) are not authorized to push | |||||||||||||||||||||||||||||||||||||||||
| 109 | *merge commits* because you're not included in the configuration option. You | ||||||||||||||||||||||||||||||||||||||||||
| 110 | must either include yourself in that option or ask somebody else to push the | ||||||||||||||||||||||||||||||||||||||||||
| 111 | commit for you. | ||||||||||||||||||||||||||||||||||||||||||
| 112 | EOS | ||||||||||||||||||||||||||||||||||||||||||
| 113 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 16 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 35 | ▶ | sub email_valid_errors { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
email_valid_errors: called CC=9 SCAR=22.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 35 | my ($git, $commit) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 35 | my $errors = 0; | |||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | 35 | my $cache = $git->cache($PKG); | |||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 35 | ▶ | if ($git->get_config_boolean($CFG => 'email-valid')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | # Let's also cache the Email::Valid object | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 2 | ▶ | unless (exists $cache->{email_valid}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 2 | $cache->{email_valid} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 2 | ▶ | if (eval { require Email::Valid; }) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 2 | my @checks; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 2 | foreach my $check (qw/mxcheck tldcheck fqdn allow_ip/) { | |||||||||||||||||||||||||||||||||||||||||
| 135 | 8 | ▶ | if (my $value = $git->get_config_boolean($CFG => "email-valid.$check")) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | push @checks, "-$check" => $value; | |||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||
| 139 | 2 | $cache->{email_valid} = Email::Valid->new(@checks); | |||||||||||||||||||||||||||||||||||||||||
| 140 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | $git->fault(<<'EOS', {option => 'email-valid.*'}); | |||||||||||||||||||||||||||||||||||||||||
| 142 | I could not load the Email::Valid Perl module. | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | I need it to validate your commit's author and committer as requested by your | ||||||||||||||||||||||||||||||||||||||||||
| 145 | configuration options. | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | Please, install the module or disable the options to proceed. | ||||||||||||||||||||||||||||||||||||||||||
| 148 | EOS | ||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ++$errors; | |||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 2 | ▶ | if (my $ev = $cache->{email_valid}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 2 | foreach my $who (qw/author committer/) { | |||||||||||||||||||||||||||||||||||||||||
| 155 | 4 | my $who_email = "${who}_email"; | |||||||||||||||||||||||||||||||||||||||||
| 156 | 4 | my $email = $commit->$who_email; | |||||||||||||||||||||||||||||||||||||||||
| 157 | 4 | ▶ | unless ($ev->address($email)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 2 | my $details = $ev->details(); | |||||||||||||||||||||||||||||||||||||||||
| 159 | 2 | $git->fault(<<"EOS", {commit => $commit}); | |||||||||||||||||||||||||||||||||||||||||
| 160 | The commit $who email ($email) failed the $details check. | ||||||||||||||||||||||||||||||||||||||||||
| 161 | 2 | @{[_amend_help($who)]} | |||||||||||||||||||||||||||||||||||||||||
| 162 | EOS | ||||||||||||||||||||||||||||||||||||||||||
| 163 | 2 | ++$errors; | |||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | 35 | return $errors; | |||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 8 | ▶ | sub _canonical_identity { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_canonical_identity: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 8 | my ($git, $mailmap, $identity) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | 8 | my $cache = $git->cache($PKG); | |||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | 8 | ▶ | unless (exists $cache->{canonical}{$identity}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 4 | $cache->{canonical}{$identity} = | |||||||||||||||||||||||||||||||||||||||||
| 179 | $git->run('-c', "mailmap.file=$mailmap", 'check-mailmap', $identity); | ||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | 8 | return $cache->{canonical}{$identity}; | |||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | 35 | ▶ | sub canonical_errors { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
canonical_errors: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | 35 | my ($git, $commit) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 35 | my $errors = 0; | |||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | 35 | ▶ | if (my $mailmap = $git->get_config($CFG => 'canonical')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 4 | foreach my $who (qw/author committer/) { | |||||||||||||||||||||||||||||||||||||||||
| 192 | 8 | my $who_name = "${who}_name"; | |||||||||||||||||||||||||||||||||||||||||
| 193 | 8 | my $who_email = "${who}_email"; | |||||||||||||||||||||||||||||||||||||||||
| 194 | 8 | my $identity = $commit->$who_name . ' <' . $commit->$who_email . '>'; | |||||||||||||||||||||||||||||||||||||||||
| 195 | 8 | my $canonical = eval {_canonical_identity($git, $mailmap, $identity) }; | |||||||||||||||||||||||||||||||||||||||||
| 196 | 8 | ▶ | unless (defined $canonical) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | $git->fault(<<'EOS', {option => 'canonical'}); | |||||||||||||||||||||||||||||||||||||||||
| 198 | Git error: could not run command git-check-mailmap. | ||||||||||||||||||||||||||||||||||||||||||
| 199 | The configuration option requires it. | ||||||||||||||||||||||||||||||||||||||||||
| 200 | It's available since Git 1.8.4. | ||||||||||||||||||||||||||||||||||||||||||
| 201 | Please, either upgrade your Git or disable this option. | ||||||||||||||||||||||||||||||||||||||||||
| 202 | EOS | ||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ++$errors; | |||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | 8 | ▶ | if ($identity ne $canonical) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | 4 | $git->fault(<<"EOS", {commit => $commit, option => 'canonical'}); | |||||||||||||||||||||||||||||||||||||||||
| 208 | The commit $who identity isn't canonical. | ||||||||||||||||||||||||||||||||||||||||||
| 209 | It's '$identity' but its canonical form is '$canonical'. | ||||||||||||||||||||||||||||||||||||||||||
| 210 | 4 | @{[_amend_help($who)]} | |||||||||||||||||||||||||||||||||||||||||
| 211 | EOS | ||||||||||||||||||||||||||||||||||||||||||
| 212 | 4 | ++$errors; | |||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | 35 | return $errors; | |||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | 17 | ▶ | sub signature_errors { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
signature_errors: called CC=8 SCAR=36.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | 17 | my ($git, $commit) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | 17 | my $errors = 0; | |||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 17 | my $signature = $git->get_config($CFG => 'signature'); | |||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | 17 | ▶ | if (defined $signature && $signature ne 'nocheck') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $signature and $signature ne "nocheck"
MC/DC0%0/2
defined $signature and $signature ne "nocheck"
defined $signature
$signature ne "nocheck"
Truth table33%1/3
A and B
A= defined $signatureB= $signature ne "nocheck"
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | my $status = $git->run(qw/log -1 --format=%G?/, $commit->commit); | |||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | if ($status eq 'B') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | $git->fault(<<'EOS', {commit => $commit, option => 'signature'}); | |||||||||||||||||||||||||||||||||||||||||
| 232 | The commit has a BAD GPG signature. | ||||||||||||||||||||||||||||||||||||||||||
| 233 | Please, amend your commit with the -S option to fix it. | ||||||||||||||||||||||||||||||||||||||||||
| 234 | EOS | ||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ++$errors; | |||||||||||||||||||||||||||||||||||||||||
| 236 | ▶ | } elsif ($status eq 'N' && $signature ne 'optional') { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$status eq "N" and $signature ne "optional"
MC/DC0%0/2
$status eq "N" and $signature ne "optional"
$status eq "N"
$signature ne "optional"
Truth table0%0/3
A and B
A= $status eq "N"B= $signature ne "optional"
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $git->fault(<<'EOS', {commit => $commit, option => 'signature'}); | |||||||||||||||||||||||||||||||||||||||||
| 238 | The commit has NO GPG signature. | ||||||||||||||||||||||||||||||||||||||||||
| 239 | Please, amend your commit with the -S option to add one. | ||||||||||||||||||||||||||||||||||||||||||
| 240 | EOS | ||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ++$errors; | |||||||||||||||||||||||||||||||||||||||||
| 242 | ▶ | } elsif ($status eq 'U' && $signature eq 'trusted') { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$status eq "U" and $signature eq "trusted"
MC/DC0%0/2
$status eq "U" and $signature eq "trusted"
$status eq "U"
$signature eq "trusted"
Truth table0%0/3
A and B
A= $status eq "U"B= $signature eq "trusted"
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | $git->fault(<<'EOS', {commit => $commit, option => 'signature'}); | |||||||||||||||||||||||||||||||||||||||||
| 244 | The commit has an UNTRUSTED GPG signature. | ||||||||||||||||||||||||||||||||||||||||||
| 245 | Please, amend your commit with the -S option to add another one. | ||||||||||||||||||||||||||||||||||||||||||
| 246 | EOS | ||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ++$errors; | |||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | 17 | return $errors; | |||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 35 | ▶ | sub code_errors { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
code_errors: called CC=15 SCAR=35.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 35 | my ($git, $commit, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 35 | my $errors = 0; | |||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | 35 | my $cache = $git->cache($PKG); | |||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | 35 | ▶ | unless (exists $cache->{codes}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 28 | $cache->{codes} = []; | |||||||||||||||||||||||||||||||||||||||||
| 263 | CODE: | ||||||||||||||||||||||||||||||||||||||||||
| 264 | 28 | foreach my $check ($git->get_config($CFG => 'check-code')) { | |||||||||||||||||||||||||||||||||||||||||
| 265 | 6 | my $code; | |||||||||||||||||||||||||||||||||||||||||
| 266 | 6 | ▶ | if ($check =~ s/^file://) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 2 | $code = do $check; | |||||||||||||||||||||||||||||||||||||||||
| 268 | 2 | ▶ | unless ($code) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | if (length $@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | $git->fault("I couldn't parse the file ($check):", | |||||||||||||||||||||||||||||||||||||||||
| 271 | {commit => $commit, option => 'check-code', details => $@}); | ||||||||||||||||||||||||||||||||||||||||||
| 272 | } elsif (! defined $code) { | ||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | $git->fault("I couldn't read the file ($check):", | |||||||||||||||||||||||||||||||||||||||||
| 274 | {commit => $commit, option => 'check-code', details => $@}); | ||||||||||||||||||||||||||||||||||||||||||
| 275 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | $git->fault("The file ($check) returned FALSE", | |||||||||||||||||||||||||||||||||||||||||
| 277 | {commit => $commit, option => 'check-code', details => $@}); | ||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | ++$errors; | |||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | next CODE; | |||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||
| 282 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 283 | 4 | $code = eval $check; ## no critic (BuiltinFunctions::ProhibitStringyEval) | |||||||||||||||||||||||||||||||||||||||||
| 284 | 4 | ▶ | if (length $@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | $git->fault("I couldn't parse the option value ($check):", | |||||||||||||||||||||||||||||||||||||||||
| 286 | {commit => $commit, option => 'check-code', details => $@}); | ||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ++$errors; | |||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | next CODE; | |||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | 6 | ▶ | if (defined $code && ref $code && ref $code eq 'CODE') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $code and ref $code and ref $code eq "CODE"
defined $code and ref $code
MC/DC0%0/3
defined $code and ref $code and ref $code eq "CODE"
defined $code
ref $code
ref $code eq "CODE"
Truth table25%1/4
A and B and C
A= defined $codeB= ref $codeC= ref $code eq "CODE"
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 6 | push $cache->{codes}->@*, $code; | |||||||||||||||||||||||||||||||||||||||||
| 293 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | $git->fault("The option value must end with a code ref.", | |||||||||||||||||||||||||||||||||||||||||
| 295 | {commit => $commit, option => 'check-code'}); | ||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | ++$errors; | |||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | 35 | foreach my $code ($cache->{codes}->@*) { | |||||||||||||||||||||||||||||||||||||||||
| 302 | 7 | my $ok = eval { $code->($git, $commit, $ref) }; | |||||||||||||||||||||||||||||||||||||||||
| 303 | 7 | ▶ | if (defined $ok) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | 7 | ▶ | unless ($ok) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 3 | $git->fault("Error detected while evaluating the option.", | |||||||||||||||||||||||||||||||||||||||||
| 306 | {commit => $commit, option => 'check-code'}); | ||||||||||||||||||||||||||||||||||||||||||
| 307 | 3 | ++$errors; | |||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||
| 309 | } elsif (length $@) { | ||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | $git->fault('Error detected while evaluating the option', | |||||||||||||||||||||||||||||||||||||||||
| 311 | {commit => $commit, option => 'check-code', details => $@}); | ||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ++$errors; | |||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||
| 314 | } continue { | ||||||||||||||||||||||||||||||||||||||||||
| 315 | 7 | $git->check_timeout(); | |||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | 35 | return $errors; | |||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | 17 | ▶ | sub commit_errors { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
commit_errors: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | 17 | my ($git, $commit, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | return | ||||||||||||||||||||||||||||||||||||||||||
| 325 | 17 | match_errors($git, $commit) + | |||||||||||||||||||||||||||||||||||||||||
| 326 | merge_errors($git, $commit) + | ||||||||||||||||||||||||||||||||||||||||||
| 327 | email_valid_errors($git, $commit) + | ||||||||||||||||||||||||||||||||||||||||||
| 328 | canonical_errors($git, $commit) + | ||||||||||||||||||||||||||||||||||||||||||
| 329 | signature_errors($git, $commit) + | ||||||||||||||||||||||||||||||||||||||||||
| 330 | code_errors($git, $commit, $ref); | ||||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | 10 | ▶ | sub check_ref { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_ref: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | 10 | my ($git, $ref) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | 10 | my $errors = 0; | |||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | 10 | my @commits = $git->get_affected_ref_commits($ref); | |||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | 10 | ▶ | if (my $limit = $git->get_config_integer($CFG => 'push-limit')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 341 | 1 | ▶ | if (@commits > $limit) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | 1 | $git->fault(<<"EOS", {ref => $ref, option => 'push-limit'}); | |||||||||||||||||||||||||||||||||||||||||
| 343 | 1 | Are you sure you want to push @{[scalar @commits]} commits to this reference at | |||||||||||||||||||||||||||||||||||||||||
| 344 | once? | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | The configuration option currently allows one to push at most $limit commits to | ||||||||||||||||||||||||||||||||||||||||||
| 347 | a reference at once. | ||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||
| 349 | If you're sure about this you can break the whole commit sequence in smaller | ||||||||||||||||||||||||||||||||||||||||||
| 350 | subsequences and push them one at a time. | ||||||||||||||||||||||||||||||||||||||||||
| 351 | EOS | ||||||||||||||||||||||||||||||||||||||||||
| 352 | 1 | ++$errors; | |||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | 10 | foreach my $commit (@commits) { | |||||||||||||||||||||||||||||||||||||||||
| 357 | 17 | $errors += commit_errors($git, $commit, $ref); | |||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | 10 | return $errors; | |||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | 18 | ▶ | sub check_commit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_commit: called CC=5 SCAR=18.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | 18 | my ($git) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | # Grok author and committer information from git's environment variables, if | ||||||||||||||||||||||||||||||||||||||||||
| 367 | # they're defined. Sometimes they aren't... | ||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | 18 | ▶ | my $author_name = $ENV{GIT_AUTHOR_NAME} || 'nobody'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{'GIT_AUTHOR_NAME'} || 'nobody'
MC/DC0%0/1
$ENV{'GIT_AUTHOR_NAME'} || 'nobody'
$ENV{'GIT_AUTHOR_NAME'}
Truth table50%1/2
A
A= $ENV{'GIT_AUTHOR_NAME'}
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | 18 | ▶ | my $author_email = $ENV{GIT_AUTHOR_EMAIL} || 'nobody@example.net'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$ENV{'GIT_AUTHOR_EMAIL'} || 'nobody@example.net'
MC/DC0%0/1
$ENV{'GIT_AUTHOR_EMAIL'} || 'nobody@example.net'
$ENV{'GIT_AUTHOR_EMAIL'}
Truth table50%1/2
A
A= $ENV{'GIT_AUTHOR_EMAIL'}
| |||||||||||||||||||||||||||||||||||||||||||
| 371 | 18 | ▶ | my $committer_name = $ENV{GIT_COMMITTER_NAME} || $author_name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$ENV{'GIT_COMMITTER_NAME'} || $author_name
MC/DC0%0/2
$ENV{'GIT_COMMITTER_NAME'} || $author_name
$ENV{'GIT_COMMITTER_NAME'}
$author_name
Truth table33%1/3
A || B
A= $ENV{'GIT_COMMITTER_NAME'}B= $author_name
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | 18 | ▶ | my $committer_email = $ENV{GIT_COMMITTER_EMAIL} || $author_email; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$ENV{'GIT_COMMITTER_EMAIL'} || $author_email
MC/DC0%0/2
$ENV{'GIT_COMMITTER_EMAIL'} || $author_email
$ENV{'GIT_COMMITTER_EMAIL'}
$author_email
Truth table33%1/3
A || B
A= $ENV{'GIT_COMMITTER_EMAIL'}B= $author_email
| |||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | # Construct a fake commit object to pass to the error checking routines. | ||||||||||||||||||||||||||||||||||||||||||
| 375 | 18 | my $commit = Git::Repository::Log->new( | |||||||||||||||||||||||||||||||||||||||||
| 376 | commit => '<new>', | ||||||||||||||||||||||||||||||||||||||||||
| 377 | author => "$author_name <$author_email> 1234567890 -0300", | ||||||||||||||||||||||||||||||||||||||||||
| 378 | committer => "$committer_name <$committer_email> 1234567890 -0300", | ||||||||||||||||||||||||||||||||||||||||||
| 379 | message => "Fake\n", | ||||||||||||||||||||||||||||||||||||||||||
| 380 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | return | ||||||||||||||||||||||||||||||||||||||||||
| 383 | 18 | match_errors($git, $commit) + | |||||||||||||||||||||||||||||||||||||||||
| 384 | email_valid_errors($git, $commit) + | ||||||||||||||||||||||||||||||||||||||||||
| 385 | canonical_errors($git, $commit) + | ||||||||||||||||||||||||||||||||||||||||||
| 386 | code_errors($git, $commit); | ||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | sub check_post_commit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_post_commit: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | my ($git) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | $log->debug(__PACKAGE__ . "::check_post_commit"); | |||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | _setup_config($git); | |||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | my $current_branch = $git->get_current_branch(); | |||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | return 1 unless $git->is_reference_enabled($current_branch); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | return signature_errors($git, $git->get_commit('HEAD')); | |||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | ▶ | sub check_patchset { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_patchset: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | my ($git, $branch, $commit) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | return commit_errors($git, $commit, $git->get_commit($branch)); | |||||||||||||||||||||||||||||||||||||||||
| 407 | } | ||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | # Install hooks | ||||||||||||||||||||||||||||||||||||||||||
| 410 | 30 | my $options = {config => \&_setup_config}; | |||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||
| 412 | 30 | GITHOOKS_CHECK_AFFECTED_REFS(\&check_ref, $options); | |||||||||||||||||||||||||||||||||||||||||
| 413 | 30 | GITHOOKS_CHECK_PRE_COMMIT(\&check_commit, $options); | |||||||||||||||||||||||||||||||||||||||||
| 414 | 30 | GITHOOKS_CHECK_PATCHSET(\&check_patchset, $options); | |||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||
| 416 | 30 | POST_APPLYPATCH(\&check_post_commit); | |||||||||||||||||||||||||||||||||||||||||
| 417 | 30 | POST_COMMIT(\&check_post_commit); | |||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||
| 419 | 30 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||
| 421 | __END__ | ||||||||||||||||||||||||||||||||||||||||||