git: Fix parsing of git logs with no commit messages at all.

master
Joey Hess 2008-07-17 16:53:54 -04:00
parent f66eddccc6
commit 1b318dacbd
2 changed files with 7 additions and 8 deletions

View File

@ -197,7 +197,7 @@ sub _parse_diff_tree ($@) { #{{{
} }
debug("No 'tree' seen in diff-tree output") if !defined $ci{'tree'}; debug("No 'tree' seen in diff-tree output") if !defined $ci{'tree'};
if (defined $ci{'parents'}) { if (defined $ci{'parents'}) {
$ci{'parent'} = @{ $ci{'parents'} }[0]; $ci{'parent'} = @{ $ci{'parents'} }[0];
} }
@ -205,15 +205,13 @@ sub _parse_diff_tree ($@) { #{{{
$ci{'parent'} = 0 x 40; $ci{'parent'} = 0 x 40;
} }
# Commit message. # Commit message (optional).
while (my $line = shift @{ $dt_ref }) { while ($dt_ref->[0] =~ /^ /) {
if ($line =~ m/^$/) { my $line = shift @{ $dt_ref };
# Trailing empty line signals next section.
last;
};
$line =~ s/^ //; $line =~ s/^ //;
push @{ $ci{'comment'} }, $line; push @{ $ci{'comment'} }, $line;
} }
shift @{ $dt_ref } if $dt_ref->[0] =~ /^$/;
# Modified files. # Modified files.
while (my $line = shift @{ $dt_ref }) { while (my $line = shift @{ $dt_ref }) {
@ -360,7 +358,7 @@ sub rcs_recentchanges ($) { #{{{
my @rets; my @rets;
foreach my $ci (git_commit_info('HEAD', $num)) { foreach my $ci (git_commit_info('HEAD', $num)) {
# Skip redundant commits. # 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) = ( my ($sha1, $when) = (
$ci->{'sha1'}, $ci->{'sha1'},

1
debian/changelog vendored
View File

@ -31,6 +31,7 @@ ikiwiki (2.54) UNRELEASED; urgency=low
* git: Put web committer name/openid/address in the git author field. * git: Put web committer name/openid/address in the git author field.
The committer's email address is not used (because leaking email addresses The committer's email address is not used (because leaking email addresses
is not liked by many users). Closes: #451023 is not liked by many users). Closes: #451023
* git: Fix parsing of git logs with no commit messages at all.
[ Simon McVittie ] [ Simon McVittie ]
* meta, inline: Support guid options, to allow forcing a particular url or * meta, inline: Support guid options, to allow forcing a particular url or