# [PATCH] gitweb: Remove commit title from comitdiff_plain body

2 messages from 2008-03-19 to 2008-03-19. Participants: Jakub Narebski, Junio C Hamano.
Thread: https://gitlist.dev/t/12763

## Jakub Narebski, 2008-03-19 22:28

Subject: [PATCH] gitweb: Remove commit title from comitdiff_plain body
Message-ID: <20080319222858.733.79714.stgit@localhost.localdomain>
URL: https://gitlist.dev/e/20080319222858.733.79714.stgit%40localhost.localdomain

```


Remove commit title (first line of commit message) from the "body" of
commitdiff_plain view: it is present there already in format-patch
like Subject: header.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---

 gitweb/gitweb.perl |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index ec73cb1..6e3ab85 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5122,8 +5122,11 @@ sub git_commitdiff {
 		print "Subject: " . to_utf8($co{'title'}) . "\n";
 
 		print "X-Git-Tag: $tagname\n" if $tagname;
-		print "X-Git-Url: " . $cgi->self_url() . "\n\n";
+		print "X-Git-Url: " . $cgi->self_url() . "\n";
 
+		# remove title, i.e. first line of log
+		shift @{$co{'comment'}};
+		# leading empty lines would separate headers from body
 		foreach my $line (@{$co{'comment'}}) {
 			print to_utf8($line) . "\n";
 		}

```

## Junio C Hamano, 2008-03-19 22:35

Subject: Re: [PATCH] gitweb: Remove commit title from comitdiff_plain body
Message-ID: <7vk5jy1gw6.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vk5jy1gw6.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20080319222858.733.79714.stgit@localhost.localdomain>

```
Jakub Narebski <jnareb@gmail.com> writes:

> Remove commit title (first line of commit message) from the "body" of
> commitdiff_plain view: it is present there already in format-patch
> like Subject: header.
>
> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
> ---
>
>  gitweb/gitweb.perl |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index ec73cb1..6e3ab85 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -5122,8 +5122,11 @@ sub git_commitdiff {
>  		print "Subject: " . to_utf8($co{'title'}) . "\n";
>  
>  		print "X-Git-Tag: $tagname\n" if $tagname;
> -		print "X-Git-Url: " . $cgi->self_url() . "\n\n";
> +		print "X-Git-Url: " . $cgi->self_url() . "\n";
>  
> +		# remove title, i.e. first line of log
> +		shift @{$co{'comment'}};
> +		# leading empty lines would separate headers from body
>  		foreach my $line (@{$co{'comment'}}) {
>  			print to_utf8($line) . "\n";
>  		}

You seem to be assuming messages that follow git convention, but is it a
good assumption here?  E.g. is the first element of @[$co{'comment'}]
always known to be non blank?  is the second element guaranteed to be
empty?

```
