Skip to content


Adding filter_out and filter_in options #7

merged 1 commit into from

2 participants


Added two options (filter_out and filter_in). These allow you to filter which commit messages are included in your Changes file.

filter_out allows you to specify a regular expression which excludes the matching commit messages,
filter_in does the opposite: only the matching commit messages are included.

I think that these are useful, but I'm not sure about the names -- filter_in and filter_out were the best ones I could think of.

Let me know if you think this is worth including or if you want me to change anything (you can also find me at, user andrefs).


I'm going to change filter_out and filter_in to exclude_message and include_message, in case someone wants to add criteria later.

@rcaputo rcaputo merged commit ae720c1 into rcaputo:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 26, 2012
  1. @andrefs
This page is out of date. Refresh to see the latest.
Showing with 40 additions and 0 deletions.
  1. +40 −0 lib/Dist/Zilla/Plugin/
40 lib/Dist/Zilla/Plugin/
@@ -82,6 +82,16 @@ has earliest_date => (
+has filter_in => (
+ is => 'ro',
+ isa => 'Str',
+has filter_out => (
+ is => 'ro',
+ isa => 'Str',
sub gather_files {
my ($self, $arg) = @_;
@@ -159,6 +169,15 @@ sub gather_files {
my $iter = Git::Repository::Log::Iterator->new($release_range);
while (my $log = $iter->next) {
+ if($self->filter_out) {
+ my $out_re = $self->filter_out();
+ next if $log->message =~ /$out_re/;
+ }
+ if($self->filter_in){
+ my $in_re = $self->filter_in();
+ next unless $log->message =~ /$in_re/;
+ }
+ #print STDERR "LOG: ".$log->message."\n";
warn(" ", $log->commit(), " ", $log->committer_localtime, "\n") if (
@@ -473,6 +492,27 @@ runtime tracing on STDERR.
debug = 1
+=head2 filter_out = REGULAR_EXPRESSION
+C<filter_out> sets a regular expression which discards matching commit
+messages. This provides a way to exclude commit messages such as
+'forgot to include file X' or 'typo'.
+ [ChangelogFromGit]
+ filter_out = ^forgot
+=head2 filter_in = REGULAR_EXPRESSION
+C<filter_in> does the opposite of C<filter_out>: it sets a regular
+expression which commit messages must match in order to be included
+in the Changes file. This means that when making a commit whith a
+relevant message, you can include the regular expression pattern to
+have it included in the Changes file, and ignore all the irrelevant
+commit messages.
+ [ChangelogFromGit]
+ filter_in = ^Major
Dist::Zilla::ChangelogFromGit collects the tags matching C<tag_regexp>
Something went wrong with that request. Please try again.