bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about your Gnulib module gitlog-to-changelog


From: Jim Meyering
Subject: Re: Question about your Gnulib module gitlog-to-changelog
Date: Thu, 04 Jun 2009 11:11:07 +0200

Boris Petersen wrote:
> Thanks for your reply.
> 11:48:25 address@hidden ~ $ git --version
> git version 1.6.3.1
>
> git repo: git://repo.or.cz/centerim.git
>
> 11:48:27 address@hidden ~ $ cat .gitconfig
> [user]
>         name = Boris Petersen
>         email = address@hidden
> signingkey = 13794A82
>
> [color]
> branch = true
> diff = true
> status = true
>         ui = auto
>
> [i18n]
> commitEncoding = utf-8
> logOutputEncoding = utf-8
>
> 2009/5/28 Jim Meyering <address@hidden>:
>> Boris Petersen wrote:
>>> I'm writing you because i discovered a problem in your gnulib script
>>> gitlog-to-changelog. The problem lies in the lines:
>>>
>>>       # Remove leading and trailing blank lines.
>>>       while ($line[0] =~ /^\s*$/) { shift @line; }
>>>       while ($line[$#line] =~ /^\s*$/) { pop @line; }
>>>
>>> If i run the script, my screen gets flooded with lines like this:
>>>
>>> Use of uninitialized value in pattern match (m//) at
>>> ./gitlog-to-changelog line 149, <PIPE> line 783.
>>>
>>> If i comment these lines in the code the script runs perfectly although
>>> i have all this blank lines in the Changelog. Do you have any ideas?
>>
>> Tell me how to reproduce it and I'll fix it.
>> I.e., how you're running it, and point me to the containing .git
>> repository.  If needed, tar up your .git/ dir and point me to the tarball.
>> Also include your ~/.gitconfig file.
>>
>> Also, what version of git are you using?
>> Comments in the code say it must be git-1.5.1 or newer,
>> but that's really too old for general use.
>> IMHO, everyone should be using git-1.6.x, for x >= 2

That arose for your repository because you have
some empty commit messages.  Recent versions of git
refuse to create such commits.  Here's what the fixed
version of this script produces for your repository:

    $ /gnulib/build-aux/gitlog-to-changelog > k
    gitlog-to-changelog: warning: empty commit message:
      2007-03-28  Pavol Rusnak  <address@hidden>

    gitlog-to-changelog: warning: empty commit message:
      2007-03-20  Oliver Hohlfeld  <address@hidden>

    gitlog-to-changelog: warning: empty commit message:
      2007-03-19  Oliver Hohlfeld  <address@hidden>

    gitlog-to-changelog: warning: empty commit message:
      2006-12-23  David Riebenbauer  <address@hidden>

I've just pushed the following fix:

>From 1a91d78bf437db3d5fb37a6deace2bd928f71c0b Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 4 Jun 2009 11:06:35 +0200
Subject: [PATCH] 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 <address@hidden>.
---
 ChangeLog                     |    6 ++++++
 build-aux/gitlog-to-changelog |   24 ++++++++++++++++--------
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5bec1da..e845591 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-06-04  Jim Meyering  <address@hidden>
+
+       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 <address@hidden>.
+
 2009-06-03  Mike Frysinger  <address@hidden>

        version-etc: extend for packagers
diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog
index 0a94b9e..1cc53eb 100755
--- 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 @@ sub quoted_cmd(@)
       # 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;
--
1.6.3.2.277.gd10543




reply via email to

[Prev in Thread] Current Thread [Next in Thread]