changeset 16018:c4f41acbfb9b

gitlog-to-changelog: avoid an infloop * build-aux/gitlog-to-changelog: Don't infloop for a commit log that ends up being empty.
author Jim Meyering <meyering@redhat.com>
date Tue, 01 Nov 2011 15:11:06 +0100
parents 69fec9ca5537
children 183973825202
files ChangeLog build-aux/gitlog-to-changelog
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-11-01  Jim Meyering  <meyering@redhat.com>
+
+	gitlog-to-changelog: avoid an infloop
+	* build-aux/gitlog-to-changelog: Don't infloop for a commit log
+	that ends up being empty.
+
 2011-11-01  Paul Eggert  <eggert@cs.ucla.edu>
 
 	* MODULES.html.sh: Fix sed-script shell quoting and locale issues.
--- a/build-aux/gitlog-to-changelog
+++ b/build-aux/gitlog-to-changelog
@@ -160,8 +160,11 @@
       @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 (@line)
+        {
+          while ($line[0] =~ /^\s*$/) { shift @line; }
+          while ($line[$#line] =~ /^\s*$/) { pop @line; }
+        }
 
       # If there were any lines
       if (@line == 0)