This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to branch master
in repository libparse-debianchangelog-perl.

commit 3a8d4f09eea2e8ae7ef8d1b2cf118e62a507047b
Author: Frank Lichtenheld <fr...@lichtenheld.de>
Date:   Sat Sep 1 03:19:42 2007 +0200

    Parse::DebianChangelog: Fix handling of epoch
    
    From: Stephen Gildea <stepheng+debian-...@gildea.com>
    
    Classic undefined vs. zero error. Fix handling of changelog
    entries that have the epoch (i.e. timestamp 0) as their date.
---
 lib/Parse/DebianChangelog.pm | 16 +++++++++-------
 t/examples/countme           |  2 +-
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/lib/Parse/DebianChangelog.pm b/lib/Parse/DebianChangelog.pm
index 7c4b0d0..17f9feb 100644
--- a/lib/Parse/DebianChangelog.pm
+++ b/lib/Parse/DebianChangelog.pm
@@ -403,12 +403,14 @@ sub parse {
            }
            $entry->{'Trailer'} = $_;
            $entry->{'Maintainer'} = "$1 <$2>" unless $entry->{'Maintainer'};
-           unless($entry->{'Date'} && $entry->{'Timestamp'}) {
+           unless($entry->{'Date'} && defined $entry->{'Timestamp'}) {
                $entry->{'Date'} = "$4";
-               $entry->{'Timestamp'} = str2time($4)
-                   or $self->_do_parse_error( $file, $NR,
-                                              __g( "couldn't parse date %s",
-                                                   "$4" ) );
+               $entry->{'Timestamp'} = str2time($4);
+               unless (defined $entry->{'Timestamp'}) {
+                   $self->_do_parse_error( $file, $NR,
+                                           __g( "couldn't parse date %s",
+                                                "$4" ) );
+               }
            }
            $expect = 'next heading or eof';
        } elsif (m/^ \-\-/) {
@@ -962,7 +964,7 @@ sub html {
     my $last_year;
     foreach my $entry (@$data) {
        my $year = $last_year; # try to deal gracefully with unparsable dates
-       if ($entry->{Timestamp}) {
+       if (defined $entry->{Timestamp}) {
            $year = (gmtime($entry->{Timestamp}))[5] + 1900;
            $last_year = $year;
        }
@@ -992,7 +994,7 @@ sub html {
     $last_year = undef;
     foreach my $entry (@$data) {
        my $year = $last_year; # try to deal gracefully with unparsable dates
-       if ($entry->{Timestamp}) {
+       if (defined $entry->{Timestamp}) {
            $year = (gmtime($entry->{Timestamp}))[5] + 1900;
        }
        $year ||= (($entry->{Date} =~ /\s(\d{4})\s/) ? $1 : (gmtime)[5] + 1900);
diff --git a/t/examples/countme b/t/examples/countme
index 3fbe782..166b72f 100644
--- a/t/examples/countme
+++ b/t/examples/countme
@@ -38,4 +38,4 @@ countme (1.5-1) unstable; urgency=low
 
   * Initial
 
- -- Frank Lichtenheld <fr...@lichtenheld.de>  Tue,  4 Oct 2005 01:46:45 +0200
+ -- Frank Lichtenheld <fr...@lichtenheld.de>  Thu, 01 Jan 1970 00:00:00 +0000

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-perl/packages/libparse-debianchangelog-perl.git

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to