From 9bb41f2a4e890e3a93991d2ae26581e334d274f3 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 1 Nov 2011 15:11:06 +0100 Subject: [PATCH] gitlog-to-changelog: avoid an infloop * build-aux/gitlog-to-changelog: Don't infloop for a commit log that ends up being empty. --- ChangeLog | 6 ++++++ build-aux/gitlog-to-changelog | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d5df470f05..1fece4d958 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-11-01 Jim Meyering + + 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 * MODULES.html.sh: Fix sed-script shell quoting and locale issues. diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog index c7763138e4..4612d38999 100755 --- a/build-aux/gitlog-to-changelog +++ b/build-aux/gitlog-to-changelog @@ -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) -- 2.39.5