Merge branch 'nk/maint-gitweb-log-by-lines'

Teach gitweb to pay attention to various forms of credits that are
similar to "Signed-off-by:" lines.

* nk/maint-gitweb-log-by-lines:
  gitweb: Add support to Link: tag
  gitweb: Handle other types of tag in git_print_log
  gitweb: Cleanup git_print_log()
This commit is contained in:
Junio C Hamano 2012-07-23 20:55:07 -07:00
commit 6da9ded763

View File

@ -4484,30 +4484,33 @@ sub git_print_log {
} }
# print log # print log
my $signoff = 0; my $skip_blank_line = 0;
my $empty = 0;
foreach my $line (@$log) { foreach my $line (@$log) {
if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) { if ($line =~ m/^\s*([A-Z][-A-Za-z]*-[Bb]y|C[Cc]): /) {
$signoff = 1;
$empty = 0;
if (! $opts{'-remove_signoff'}) { if (! $opts{'-remove_signoff'}) {
print "<span class=\"signoff\">" . esc_html($line) . "</span><br/>\n"; print "<span class=\"signoff\">" . esc_html($line) . "</span><br/>\n";
next; $skip_blank_line = 1;
} else {
# remove signoff lines
next;
} }
} else { next;
$signoff = 0; }
if ($line =~ m,\s*([a-z]*link): (https?://\S+),i) {
if (! $opts{'-remove_signoff'}) {
print "<span class=\"signoff\">" . esc_html($1) . ": " .
"<a href=\"" . esc_html($2) . "\">" . esc_html($2) . "</a>" .
"</span><br/>\n";
$skip_blank_line = 1;
}
next;
} }
# print only one empty line # print only one empty line
# do not print empty line after signoff # do not print empty line after signoff
if ($line eq "") { if ($line eq "") {
next if ($empty || $signoff); next if ($skip_blank_line);
$empty = 1; $skip_blank_line = 1;
} else { } else {
$empty = 0; $skip_blank_line = 0;
} }
print format_log_line_html($line) . "<br/>\n"; print format_log_line_html($line) . "<br/>\n";
@ -4515,7 +4518,7 @@ sub git_print_log {
if ($opts{'-final_empty_line'}) { if ($opts{'-final_empty_line'}) {
# end with single empty line # end with single empty line
print "<br/>\n" unless $empty; print "<br/>\n" unless $skip_blank_line;
} }
} }