From 989fbe475b9041f780a58a613b2126da5edb8f8a Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Mon, 5 Oct 2009 16:06:01 +0100 Subject: [PATCH] gitlog-to-changelog: If the date field is empty, don't barf. --- gitlog-to-changelog | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/gitlog-to-changelog b/gitlog-to-changelog index a0f8a08..cf0fef0 100755 --- a/gitlog-to-changelog +++ b/gitlog-to-changelog @@ -1,7 +1,7 @@ #!/usr/bin/perl # Convert git log output to ChangeLog format. -my $VERSION = '2009-08-12 16:49'; # UTC +my $VERSION = '2009-10-05 15:04'; # 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 @@ -132,20 +132,18 @@ sub quoted_cmd(@) my $author_line = shift @line; defined $author_line or die "$ME:$.: unexpected EOF\n"; - $author_line =~ /^(\d+) (.*>)$/ - or die "$ME:$.: Invalid line " - . "(expected date/author/email):\n$author_line\n"; - - my $date_line = sprintf "%s $2\n", strftime ("%F", localtime ($1)); - # If this line would be the same as the previous date/name/email - # line, then arrange not to print it. - if ($date_line ne $prev_date_line) - { - $prev_date_line eq '' - or print "\n"; - print $date_line; - } - $prev_date_line = $date_line; + if ($author_line =~ /^(\d+) (.*>)$/) { + my $date_line = sprintf "%s $2\n", strftime ("%F", localtime ($1)); + # If this line would be the same as the previous date/name/email + # line, then arrange not to print it. + if ($date_line ne $prev_date_line) + { + $prev_date_line eq '' + or print "\n"; + print $date_line; + } + $prev_date_line = $date_line; + } # Omit "Signed-off-by..." lines. @line = grep !/^Signed-off-by: .*>$/, @line; @@ -153,7 +151,7 @@ sub quoted_cmd(@) # If there were any lines if (@line == 0) { - warn "$ME: warning: empty commit message:\n $date_line\n"; + warn "$ME: warning: empty commit message:\n $prev_date_line\n"; } else { -- 1.8.3.1