changeset 11604:6855551f304d

gitlog-to-changelog: don't infloop on an empty commit log * build-aux/gitlog-to-changelog: Warn about an empty log message. Reported by Boris Petersen <transacid@centerim.org>.
author Jim Meyering <meyering@redhat.com>
date Thu, 04 Jun 2009 11:06:35 +0200
parents 95f56b9a5977
children e44545af8f70
files ChangeLog build-aux/gitlog-to-changelog
diffstat 2 files changed, 22 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-06-04  Jim Meyering  <meyering@redhat.com>
+
+	gitlog-to-changelog: don't infloop on an empty commit log
+	* build-aux/gitlog-to-changelog: Warn about an empty log message.
+	Reported by Boris Petersen <transacid@centerim.org>.
+
 2009-06-03  Mike Frysinger  <vapier@gentoo.org>
 
 	version-etc: extend for packagers
--- a/build-aux/gitlog-to-changelog
+++ b/build-aux/gitlog-to-changelog
@@ -1,13 +1,13 @@
 #!/usr/bin/perl
 # Convert git log output to ChangeLog format.
 
-my $VERSION = '2008-12-21 12:07'; # UTC
+my $VERSION = '2009-06-04 08:53'; # 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
 # do its job.  Otherwise, update this string manually.
 
-# Copyright (C) 2008 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -145,14 +145,22 @@
       # Omit "Signed-off-by..." lines.
       @line = grep !/^Signed-off-by: .*>$/, @line;
 
-      # Remove leading and trailing blank lines.
-      while ($line[0] =~ /^\s*$/) { shift @line; }
-      while ($line[$#line] =~ /^\s*$/) { pop @line; }
+      # If there were any lines
+      if (@line == 0)
+        {
+          warn "$ME: warning: empty commit message:\n  $date_line\n";
+        }
+      else
+        {
+          # Remove leading and trailing blank lines.
+          while ($line[0] =~ /^\s*$/) { shift @line; }
+          while ($line[$#line] =~ /^\s*$/) { pop @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>)
         or last;