summaryrefslogtreecommitdiff
path: root/build-aux/gitlog-to-changelog
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-03-20 17:40:37 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2015-03-20 18:53:55 -0700
commit84f5241b99ffcb8672997a2cef5e65616121bcf4 (patch)
tree69fbcb9cd416166303a4ee00341b647a963f2ab3 /build-aux/gitlog-to-changelog
parenta277f536d9b33ebc24893d946fb8be14f23c9d00 (diff)
downloadgnulib-84f5241b99ffcb8672997a2cef5e65616121bcf4.tar.gz
gitlog-to-changelog: new option --ignore-matching
* build-aux/gitlog-to-changelog (usage, git_dir_option, main): Support new option --ignore-matching=PAT, which ignores all commit messages whose first line matches PAT.
Diffstat (limited to 'build-aux/gitlog-to-changelog')
-rwxr-xr-xbuild-aux/gitlog-to-changelog114
1 files changed, 61 insertions, 53 deletions
diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog
index de934c2daa..747353a5c5 100755
--- a/build-aux/gitlog-to-changelog
+++ b/build-aux/gitlog-to-changelog
@@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
if 0;
# Convert git log output to ChangeLog format.
-my $VERSION = '2014-11-20 17:25'; # UTC
+my $VERSION = '2015-03-20 22:09'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
@@ -73,6 +73,7 @@ OPTIONS:
--since=DATE convert only the logs since DATE;
the default is to convert all log entries.
--until=DATE convert only the logs older than DATE.
+ --ignore-matching=PAT ignore commit messages whose first lines match PAT.
--format=FMT set format string for commit subject and body;
see 'man git-log' for the list of format metacharacters;
the default is '%s%n%b%n'
@@ -226,6 +227,7 @@ sub git_dir_option($)
my $amend_file;
my $append_dot = 0;
my $cluster = 1;
+ my $ignore_matching;
my $strip_tab = 0;
my $strip_cherry_pick = 0;
my $srcdir;
@@ -239,6 +241,7 @@ sub git_dir_option($)
'amend=s' => \$amend_file,
'append-dot' => \$append_dot,
'cluster!' => \$cluster,
+ 'ignore-matching=s' => \$ignore_matching,
'strip-tab' => \$strip_tab,
'strip-cherry-pick' => \$strip_cherry_pick,
'srcdir=s' => \$srcdir,
@@ -341,68 +344,73 @@ sub git_dir_option($)
while ($line[$#line] =~ /^\s*$/) { pop @line; }
}
- # Record whether there are two or more paragraphs.
- my $multi_paragraph = grep /^\s*$/, @line;
-
- # Format 'Co-authored-by: A U Thor <email@example.com>' lines in
- # standard multi-author ChangeLog format.
- for (@coauthors)
+ # Ignore commits that match the --ignore-matching pattern, if specified.
+ if (! (defined $ignore_matching
+ && @line && $line[0] =~ /$ignore_matching/))
{
- s/^Co-authored-by:\s*/\t /;
- s/\s*</ </;
+ # Record whether there are two or more paragraphs.
+ my $multi_paragraph = grep /^\s*$/, @line;
- /<.*?@.*\..*>/
- or warn "$ME: warning: missing email address for "
- . substr ($_, 5) . "\n";
- }
+ # Format 'Co-authored-by: A U Thor <email@example.com>' lines in
+ # standard multi-author ChangeLog format.
+ for (@coauthors)
+ {
+ s/^Co-authored-by:\s*/\t /;
+ s/\s*</ </;
- # If clustering of commit messages has been disabled, if this header
- # would be different from the previous date/name/email/coauthors header,
- # or if this or the previous entry consists of two or more paragraphs,
- # then print the header.
- if ( ! $cluster
- || $date_line ne $prev_date_line
- || "@coauthors" ne "@prev_coauthors"
- || $multi_paragraph
- || $prev_multi_paragraph)
- {
- $prev_date_line eq ''
- or print "\n";
- print $date_line;
- @coauthors
- and print join ("\n", @coauthors), "\n";
- }
- $prev_date_line = $date_line;
- @prev_coauthors = @coauthors;
- $prev_multi_paragraph = $multi_paragraph;
+ /<.*?@.*\..*>/
+ or warn "$ME: warning: missing email address for "
+ . substr ($_, 5) . "\n";
+ }
- # If there were any lines
- if (@line == 0)
- {
- warn "$ME: warning: empty commit message:\n $date_line\n";
- }
- else
- {
- if ($append_dot)
+ # If clustering of commit messages has been disabled, if this header
+ # would be different from the previous date/name/etc. header,
+ # or if this or the previous entry consists of two or more paragraphs,
+ # then print the header.
+ if ( ! $cluster
+ || $date_line ne $prev_date_line
+ || "@coauthors" ne "@prev_coauthors"
+ || $multi_paragraph
+ || $prev_multi_paragraph)
+ {
+ $prev_date_line eq ''
+ or print "\n";
+ print $date_line;
+ @coauthors
+ and print join ("\n", @coauthors), "\n";
+ }
+ $prev_date_line = $date_line;
+ @prev_coauthors = @coauthors;
+ $prev_multi_paragraph = $multi_paragraph;
+
+ # If there were any lines
+ if (@line == 0)
{
- # If the first line of the message has enough room, then
- if (length $line[0] < 72)
+ warn "$ME: warning: empty commit message:\n $date_line\n";
+ }
+ else
+ {
+ if ($append_dot)
{
- # append a dot if there is no other punctuation or blank
- # at the end.
- $line[0] =~ /[[:punct:]\s]$/
- or $line[0] .= '.';
+ # If the first line of the message has enough room, then
+ if (length $line[0] < 72)
+ {
+ # append a dot if there is no other punctuation or blank
+ # at the end.
+ $line[0] =~ /[[:punct:]\s]$/
+ or $line[0] .= '.';
+ }
}
- }
- # Remove one additional leading TAB from each line.
- $strip_tab
- and map { s/^\t// } @line;
+ # Remove one additional leading TAB from each line.
+ $strip_tab
+ and map { s/^\t// } @line;
- # Prefix each non-empty line with a TAB.
- @line = map { length $_ ? "\t$_" : '' } @line;
+ # Prefix each non-empty line with a TAB.
+ @line = map { length $_ ? "\t$_" : '' } @line;
- print "\n", join ("\n", @line), "\n";
+ print "\n", join ("\n", @line), "\n";
+ }
}
defined ($in = <PIPE>)