From: Eric Wong Date: Mon, 14 Mar 2016 21:23:28 +0000 (+0000) Subject: repobrowse: summary handles multiple README types X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7d88f5491d5c0d68842fbc4b5e4ca4afc93903ef;p=thirdparty%2Fpublic-inbox.git repobrowse: summary handles multiple README types git.git uses README.md, nowadays, but older revisions used plain old README. Handle both out-of-the box. --- diff --git a/lib/PublicInbox/RepobrowseGitSummary.pm b/lib/PublicInbox/RepobrowseGitSummary.pm index 0dffd5cc7..3ddfbe742 100644 --- a/lib/PublicInbox/RepobrowseGitSummary.pm +++ b/lib/PublicInbox/RepobrowseGitSummary.pm @@ -70,13 +70,13 @@ sub emit_summary { # some people will use README.md or even README.sh here... my $readme = $repo_info->{readme}; - defined $readme or $readme = 'README'; - my $doc = $git->cat_file('HEAD:'.$readme); - if (defined $doc) { - $fh->write('
' .
-			readme_path_links($rel, $readme) . " (HEAD)\n\n");
-		$fh->write(utf8_html($$doc));
-		$fh->write('
'); + defined $readme or $readme = [ 'README', 'README.md' ]; + $readme = [ $readme ] if (ref($readme) ne 'ARRAY'); + foreach my $r (@$readme) { + my $doc = $git->cat_file('HEAD:'.$r); + defined $doc or next; + $fh->write('
' . readme_path_links($rel, $r) .
+			" (HEAD)\n\n" . utf8_html($$doc) . '
'); } $fh->write(''); $fh->close;