Skip to content

Commit 6da9ded

Browse files
committed
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()
2 parents e771946 + 66c857e commit 6da9ded

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

gitweb/gitweb.perl

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4484,38 +4484,41 @@ sub git_print_log {
44844484
}
44854485

44864486
# print log
4487-
my $signoff = 0;
4488-
my $empty = 0;
4487+
my $skip_blank_line = 0;
44894488
foreach my $line (@$log) {
4490-
if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
4491-
$signoff = 1;
4492-
$empty = 0;
4489+
if ($line =~ m/^\s*([A-Z][-A-Za-z]*-[Bb]y|C[Cc]): /) {
44934490
if (! $opts{'-remove_signoff'}) {
44944491
print "<span class=\"signoff\">" . esc_html($line) . "</span><br/>\n";
4495-
next;
4496-
} else {
4497-
# remove signoff lines
4498-
next;
4492+
$skip_blank_line = 1;
44994493
}
4500-
} else {
4501-
$signoff = 0;
4494+
next;
4495+
}
4496+
4497+
if ($line =~ m,\s*([a-z]*link): (https?://\S+),i) {
4498+
if (! $opts{'-remove_signoff'}) {
4499+
print "<span class=\"signoff\">" . esc_html($1) . ": " .
4500+
"<a href=\"" . esc_html($2) . "\">" . esc_html($2) . "</a>" .
4501+
"</span><br/>\n";
4502+
$skip_blank_line = 1;
4503+
}
4504+
next;
45024505
}
45034506

45044507
# print only one empty line
45054508
# do not print empty line after signoff
45064509
if ($line eq "") {
4507-
next if ($empty || $signoff);
4508-
$empty = 1;
4510+
next if ($skip_blank_line);
4511+
$skip_blank_line = 1;
45094512
} else {
4510-
$empty = 0;
4513+
$skip_blank_line = 0;
45114514
}
45124515

45134516
print format_log_line_html($line) . "<br/>\n";
45144517
}
45154518

45164519
if ($opts{'-final_empty_line'}) {
45174520
# end with single empty line
4518-
print "<br/>\n" unless $empty;
4521+
print "<br/>\n" unless $skip_blank_line;
45194522
}
45204523
}
45214524

0 commit comments

Comments
 (0)