Dmitry V. Levin wrote: ... > Subject: [PATCH] gitlog-to-changelog: new option --append-dot > > * build-aux/gitlog-to-changelog: New option --append-dot, makes the > first non-blank line of each commit message terminated with a dot. > --- > ChangeLog | 6 ++++++ > build-aux/gitlog-to-changelog | 15 +++++++++++++++ > 2 files changed, 21 insertions(+), 0 deletions(-) > > diff --git a/ChangeLog b/ChangeLog > index 30cc2af..76d1c64 100644 > --- a/ChangeLog > +++ b/ChangeLog > @@ -1,3 +1,9 @@ > +2011-10-30 Dmitry V. Levin <l...@altlinux.org> > + > + gitlog-to-changelog: new option --append-dot. > + * build-aux/gitlog-to-changelog: New option --append-dot, makes the > + first non-blank line of each commit message terminated with a dot. > + > 2011-10-29 Dmitry V. Levin <l...@altlinux.org> > > gitlog-to-changelog: treat a message with only blank lines as empty. > diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog > index a5fd80d..c6e91c3 100755 > --- a/build-aux/gitlog-to-changelog > +++ b/build-aux/gitlog-to-changelog > @@ -65,6 +65,8 @@ OPTIONS: > --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' > + --append-dot append a dot to the first line of each commit message if > + there is no other punctuation or a blank symbol at the end.
I shortened that to "or blank": (though technically blank is "space or TAB", while \s includes several more) there is no other punctuation or blank at the end. > --help display this help and exit > --version output version information and exit > @@ -102,12 +104,14 @@ sub quoted_cmd(@) > { > my $since_date = '1970-01-01 UTC'; > my $format_string = '%s%n%b%n'; > + my $append_dot = 0; > GetOptions > ( > help => sub { usage 0 }, > version => sub { print "$ME version $VERSION\n"; exit }, > 'since=s' => \$since_date, > 'format=s' => \$format_string, > + 'append-dot' => \$append_dot, > ) or usage 1; > > my @cmd = (qw (git log --log-size), "--since=$since_date", > @@ -163,6 +167,17 @@ sub quoted_cmd(@) > } > else > { > + if ($append_dot) > + { > + # 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 a blank symbol at the end. > + $line[0] =~ /[[:punct:]\s]$/ or $line[0] .= "."; And put the "or ..." on a 2nd line: $line[0] =~ /[[:punct:]\s]$/ or $line[0] .= '.'; > + } > + } Here's the result. I'll wait for an ACK from you in case there's anything you'd like to adjust. >From 6fa93934508389f8f2dd0f921ebb6c720aa49cdf Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" <l...@altlinux.org> Date: Sun, 30 Oct 2011 22:00:00 +0000 Subject: [PATCH] gitlog-to-changelog: new option --append-dot * build-aux/gitlog-to-changelog: New option --append-dot, makes the first non-blank line of each commit message terminated with a dot. --- ChangeLog | 6 ++++++ build-aux/gitlog-to-changelog | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4c4b7e2..a692aa9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-10-30 Dmitry V. Levin <l...@altlinux.org> + + gitlog-to-changelog: new option --append-dot. + * build-aux/gitlog-to-changelog: New option --append-dot, makes the + first non-blank line of each commit message terminated with a dot. + 2011-10-30 Bruno Haible <br...@clisp.org> ffsl, ffsll: Avoid compilation error due to 'restrict'. diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog index a5fd80d..c3a5ef3 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 = '2009-10-30 13:46'; # UTC +my $VERSION = '2011-10-31 07:45'; # 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 @@ -65,6 +65,8 @@ OPTIONS: --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' + --append-dot append a dot to the first line of each commit message if + there is no other punctuation or blank at the end. --help display this help and exit --version output version information and exit @@ -102,12 +104,14 @@ sub quoted_cmd(@) { my $since_date = '1970-01-01 UTC'; my $format_string = '%s%n%b%n'; + my $append_dot = 0; GetOptions ( help => sub { usage 0 }, version => sub { print "$ME version $VERSION\n"; exit }, 'since=s' => \$since_date, 'format=s' => \$format_string, + 'append-dot' => \$append_dot, ) or usage 1; my @cmd = (qw (git log --log-size), "--since=$since_date", @@ -163,6 +167,18 @@ sub quoted_cmd(@) } else { + if ($append_dot) + { + # 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] .= '.'; + } + } + # Prefix each non-empty line with a TAB. @line = map { length $_ ? "\t$_" : '' } @line; -- 1.7.7.1.476.g9890