# [PATCH] gitweb: Recognize *-to and Closes/Fixes trailers

3 messages from 2020-04-25 to 2020-04-25. Participants: Emma Brooks, Junio C Hamano.
Thread: https://gitlist.dev/t/53316

## Emma Brooks, 2020-04-25 02:17

Subject: [PATCH] gitweb: Recognize *-to and Closes/Fixes trailers
Message-ID: <20200425021723.16346-1-me@pluvano.com>
URL: https://gitlist.dev/e/20200425021723.16346-1-me%40pluvano.com

```
Commit trailers like "Thanks-to:", "Fixes:", and "Closes:" are fairly
common, but gitweb didn't highlight them like other trailers.

Signed-off-by: Emma Brooks <me@pluvano.com>
---
 gitweb/gitweb.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 1a02a1242d..0959a782ec 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4641,7 +4641,7 @@ sub git_print_log {
 	# print log
 	my $skip_blank_line = 0;
 	foreach my $line (@$log) {
-		if ($line =~ m/^\s*([A-Z][-A-Za-z]*-[Bb]y|C[Cc]): /) {
+		if ($line =~ m/^\s*([A-Z][-A-Za-z]*-([Bb]y|[Tt]o)|C[Cc]|(Clos|Fix)es): /) {
 			if (! $opts{'-remove_signoff'}) {
 				print "<span class=\"signoff\">" . esc_html($line) . "</span><br/>\n";
 				$skip_blank_line = 1;

```

## Junio C Hamano, 2020-04-25 05:17

Subject: Re: [PATCH] gitweb: Recognize *-to and Closes/Fixes trailers
Message-ID: <xmqqeesc9m9l.fsf@gitster.c.googlers.com>
URL: https://gitlist.dev/e/xmqqeesc9m9l.fsf%40gitster.c.googlers.com
In-Reply-To: <20200425021723.16346-1-me@pluvano.com>

```
Emma Brooks <me@pluvano.com> writes:

> Commit trailers like "Thanks-to:", "Fixes:", and "Closes:" are fairly
> common, but gitweb didn't highlight them like other trailers.

Did you also sneak "cc" in without documenting/justifying?

When the re becomes this complex, it may not be a bad idea to switch
to "/ ignore most whitespaces /x" style for readability.

> -		if ($line =~ m/^\s*([A-Z][-A-Za-z]*-[Bb]y|C[Cc]): /) {
> +		if ($line =~ m/^\s*([A-Z][-A-Za-z]*-([Bb]y|[Tt]o)|C[Cc]|(Clos|Fix)es): /) {

		if ($line =~ m/^\s*([A-Z][-A-Za-z]*-([Bb]y|[Tt]o) |
				    C[Cc] | Closes | Fixes ):\s /x) { 

Well, I am sloppy and did not make it all that easier to read.

More experienced Perl folks certainly would be able to teach us a
much better convention to format things like this more readble.


```

## Emma Brooks, 2020-04-25 06:29

Subject: Re: [PATCH] gitweb: Recognize *-to and Closes/Fixes trailers
Message-ID: <20200425062957.GA56088@pluvano.com>
URL: https://gitlist.dev/e/20200425062957.GA56088%40pluvano.com
In-Reply-To: <xmqqeesc9m9l.fsf@gitster.c.googlers.com>

```
On 2020-04-24 22:17:58-0700, Junio C Hamano wrote:
> Did you also sneak "cc" in without documenting/justifying?

No, that was already there in the original, before the colon:
> > -		if ($line =~ m/^\s*([A-Z][-A-Za-z]*-[Bb]y|C[Cc]): /) {
> > +		if ($line =~ m/^\s*([A-Z][-A-Za-z]*-([Bb]y|[Tt]o)|C[Cc]|(Clos|Fix)es): /) {

```
