]> Savannah Git Hosting - gnulib.git/commitdiff
gitlog-to-changelog: avoid an infloop
authorJim Meyering <meyering@redhat.com>
Tue, 1 Nov 2011 14:11:06 +0000 (15:11 +0100)
committerJim Meyering <meyering@redhat.com>
Wed, 2 Nov 2011 06:55:20 +0000 (07:55 +0100)
* build-aux/gitlog-to-changelog: Don't infloop for a commit log
that ends up being empty.

ChangeLog
build-aux/gitlog-to-changelog

index d5df470f05ef3e438ab600213c46956d12daa796..1fece4d958928411150e89db9a180b40d321b47b 100644 (file)
--- 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.
index c7763138e48937105a116210bdd13cc588e37307..4612d3899970d91cbc2a0425988c352409a2fa47 100755 (executable)
@@ -160,8 +160,11 @@ sub quoted_cmd(@)
       @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)