@@ -9,7 +9,7 @@ use Log::Any '$log';
9
9
use Git::Hooks;
10
10
use Git::Repository::Log;
11
11
use Path::Tiny;
12
- use List::MoreUtils qw/ last_index uniq/ ;
12
+ use List::MoreUtils qw/ any last_index uniq/ ;
13
13
14
14
my $PKG = __PACKAGE__ ;
15
15
my $CFG = __PACKAGE__ =~ s / .*::/ githooks./ r ;
@@ -32,6 +32,8 @@ sub _setup_config {
32
32
$default -> {require } //= [' true' ];
33
33
$default -> {unresolved } //= [' true' ];
34
34
35
+ push $default -> {' skip-logs' }-> @*, qr / ^(?:Merge|Reapply|Revert) / ;
36
+
35
37
return ;
36
38
}
37
39
@@ -124,6 +126,14 @@ sub _jql_query {
124
126
return $cache -> {jql }{$jql };
125
127
}
126
128
129
+ sub _skip_logs {
130
+ my ($git , $commit ) = @_ ;
131
+
132
+ state $regexes = [map {qr /$_ / } $git -> get_config($CFG => ' skip-logs' )];
133
+ my $message = $commit -> message;
134
+ return any {$message =~ $_ } @$regexes ;
135
+ }
136
+
127
137
sub _disconnect_jira {
128
138
my ($git ) = @_ ;
129
139
delete $git -> cache($PKG )-> {jira };
@@ -378,6 +388,8 @@ sub check_commit_msg {
378
388
379
389
if ($commit -> parent() > 1 && $git -> get_config_boolean($CFG => ' skip-merges' )) {
380
390
return 1;
391
+ } elsif (_skip_logs($git , $commit )) {
392
+ return 1;
381
393
} else {
382
394
return _check_jira_keys($git , $commit , $ref , uniq(grok_msg_jiras($git , $commit -> message)));
383
395
}
@@ -952,6 +964,15 @@ In this case, the visibility isn't restricted at all.
952
964
953
965
=back
954
966
967
+ =head2 skip-logs REGEXP
968
+
969
+ Use this multi-valued directive to make CheckJira don't check
970
+ commits which log messages match any of the REGEXes specified with it.
971
+
972
+ By default, CheckJira already skips commits with messages matching the REGEXP
973
+ C<qr/^(?:Merge|Reapply|Revert) / > , which most probably were created by git-merge
974
+ and git-revert commands.
975
+
955
976
=head2 skip-merges BOOL
956
977
957
978
By default, all commits are checked. You can exempt merge commits from being
0 commit comments