git: Fix parsing of git logs with no commit messages at all.
authorJoey Hess <joey@kodama.kitenet.net>
Thu, 17 Jul 2008 20:53:54 +0000 (16:53 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Thu, 17 Jul 2008 20:53:54 +0000 (16:53 -0400)
IkiWiki/Rcs/git.pm
debian/changelog

index c816d1bb5ca3234c2ad502da45386455c091efd0..26f2a39f266b88e477f75545533b2b4d5dfc524a 100644 (file)
@@ -197,7 +197,7 @@ sub _parse_diff_tree ($@) { #{{{
        }
 
        debug("No 'tree' seen in diff-tree output") if !defined $ci{'tree'};
-
+       
        if (defined $ci{'parents'}) {
                $ci{'parent'} = @{ $ci{'parents'} }[0];
        }
@@ -205,15 +205,13 @@ sub _parse_diff_tree ($@) { #{{{
                $ci{'parent'} = 0 x 40;
        }
 
-       # Commit message.
-       while (my $line = shift @{ $dt_ref }) {
-               if ($line =~ m/^$/) {
-                       # Trailing empty line signals next section.
-                       last;
-               };
+       # Commit message (optional).
+       while ($dt_ref->[0] =~ /^    /) {
+               my $line = shift @{ $dt_ref };
                $line =~ s/^    //;
                push @{ $ci{'comment'} }, $line;
        }
+       shift @{ $dt_ref } if $dt_ref->[0] =~ /^$/;
 
        # Modified files.
        while (my $line = shift @{ $dt_ref }) {
@@ -360,7 +358,7 @@ sub rcs_recentchanges ($) { #{{{
        my @rets;
        foreach my $ci (git_commit_info('HEAD', $num)) {
                # Skip redundant commits.
-               next if (@{$ci->{'comment'}}[0] eq $dummy_commit_msg);
+               next if ($ci->{'comment'} && @{$ci->{'comment'}}[0] eq $dummy_commit_msg);
 
                my ($sha1, $when) = (
                        $ci->{'sha1'},
index 16b35276673464669dfa67cf45658421476b0513..1237217412924901e65cc0b5ab532e147413549b 100644 (file)
@@ -31,6 +31,7 @@ ikiwiki (2.54) UNRELEASED; urgency=low
   * git: Put web committer name/openid/address in the git author field.
     The committer's email address is not used (because leaking email addresses
     is not liked by many users). Closes: #451023
+  * git: Fix parsing of git logs with no commit messages at all.
 
   [ Simon McVittie ]
   * meta, inline: Support guid options, to allow forcing a particular url or