Commit 314244aa authored by Glenn Morris's avatar Glenn Morris

Add option to ignore commit lines matching a pattern in ChangeLog.

* build-aux/gitlog-to-changelog: Add --ignore-line option.
* build-aux/gitlog-to-emacslog: Ignore lines matching '^; '.
; * CONTRIBUTE: Mention this.
parent 88e4dfaa
...@@ -96,6 +96,9 @@ messages: ...@@ -96,6 +96,9 @@ messages:
- Commit messages should not contain the "Signed-off-by:" lines that - Commit messages should not contain the "Signed-off-by:" lines that
are used in some other projects. are used in some other projects.
- Any lines of the the commit message that start with "; " are omitted
from the generated ChangeLog.
- Explaining the rationale for a design choice is best done in comments - Explaining the rationale for a design choice is best done in comments
in the source code. However, sometimes it is useful to describe just in the source code. However, sometimes it is useful to describe just
the rationale for a change; that can be done in the commit message the rationale for a change; that can be done in the commit message
......
...@@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}' ...@@ -3,7 +3,7 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
if 0; if 0;
# Convert git log output to ChangeLog format. # Convert git log output to ChangeLog format.
my $VERSION = '2015-05-08 06:05'; # UTC my $VERSION = '2015-05-19 01:37'; # UTC
# The definition above must lie within the first 8 lines in order # The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it. # for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook # If you change this file with Emacs, please let the write hook
...@@ -74,6 +74,7 @@ OPTIONS: ...@@ -74,6 +74,7 @@ OPTIONS:
the default is to convert all log entries. the default is to convert all log entries.
--until=DATE convert only the logs older than DATE. --until=DATE convert only the logs older than DATE.
--ignore-matching=PAT ignore commit messages whose first lines match PAT. --ignore-matching=PAT ignore commit messages whose first lines match PAT.
--ignore-line=PAT ignore lines of commit messages that match PAT.
--format=FMT set format string for commit subject and body; --format=FMT set format string for commit subject and body;
see 'man git-log' for the list of format metacharacters; see 'man git-log' for the list of format metacharacters;
the default is '%s%n%b%n' the default is '%s%n%b%n'
...@@ -228,6 +229,7 @@ sub git_dir_option($) ...@@ -228,6 +229,7 @@ sub git_dir_option($)
my $append_dot = 0; my $append_dot = 0;
my $cluster = 1; my $cluster = 1;
my $ignore_matching; my $ignore_matching;
my $ignore_line;
my $strip_tab = 0; my $strip_tab = 0;
my $strip_cherry_pick = 0; my $strip_cherry_pick = 0;
my $srcdir; my $srcdir;
...@@ -242,6 +244,7 @@ sub git_dir_option($) ...@@ -242,6 +244,7 @@ sub git_dir_option($)
'append-dot' => \$append_dot, 'append-dot' => \$append_dot,
'cluster!' => \$cluster, 'cluster!' => \$cluster,
'ignore-matching=s' => \$ignore_matching, 'ignore-matching=s' => \$ignore_matching,
'ignore-line=s' => \$ignore_line,
'strip-tab' => \$strip_tab, 'strip-tab' => \$strip_tab,
'strip-cherry-pick' => \$strip_cherry_pick, 'strip-cherry-pick' => \$strip_cherry_pick,
'srcdir=s' => \$srcdir, 'srcdir=s' => \$srcdir,
...@@ -349,6 +352,12 @@ sub git_dir_option($) ...@@ -349,6 +352,12 @@ sub git_dir_option($)
if (! (defined $ignore_matching if (! (defined $ignore_matching
&& @line && $line[0] =~ /$ignore_matching/)) && @line && $line[0] =~ /$ignore_matching/))
{ {
if (defined $ignore_line && @line)
{
@line = grep ! /$ignore_line/, @line;
while ($line[$#line] =~ /^\s*$/) { pop @line; }
}
# Record whether there are two or more paragraphs. # Record whether there are two or more paragraphs.
my $multi_paragraph = grep /^\s*$/, @line; my $multi_paragraph = grep /^\s*$/, @line;
......
...@@ -58,7 +58,7 @@ test -d .git || { ...@@ -58,7 +58,7 @@ test -d .git || {
# Use Gnulib's packaged ChangeLog generator. # Use Gnulib's packaged ChangeLog generator.
./build-aux/gitlog-to-changelog --ignore-matching='^; ' \ ./build-aux/gitlog-to-changelog --ignore-matching='^; ' \
--format='%B' \ --ignore-line='^; ' --format='%B' \
"$gen_origin.." >"ChangeLog.tmp" || exit "$gen_origin.." >"ChangeLog.tmp" || exit
if test -s "ChangeLog.tmp"; then if test -s "ChangeLog.tmp"; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment