Subject: Re: [PATCHv7 3/9] gitweb: use git_print_authorship_rows in 'tag' view too

From: Jakub Narebski <[email-masked]>
Date: Sat, 27 Jun 2009 20:10:29 +0200

On Sat, 27 June 2009, Giuseppe Bilotta wrote:

> parse_tag has to be adapted to use the hash keys expected by
> git_print_authorship_rows, which is not a problem since git_tag
> is the only user of this sub.

Nitpick: I think that with s/has/had/ (past tense) and 
s/, which/. This/ (split paragraph into two sentences)
it would read better.

> 
> Signed-off-by: Giuseppe Bilotta <[email-masked]>

Acked-by: Jakub Narebski <[email-masked]>

> ---
>  gitweb/gitweb.perl |   16 +++++++++-------
>  1 files changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 0d8005d..7183ad2 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -2409,8 +2409,14 @@ sub parse_tag {
>  			$tag{'name'} = $1;
>  		} elsif ($line =~ m/^tagger (.*) ([0-9]+) (.*)$/) {
>  			$tag{'author'} = $1;
> -			$tag{'epoch'} = $2;
> -			$tag{'tz'} = $3;
> +			$tag{'author_epoch'} = $2;
> +			$tag{'author_tz'} = $3;
> +			if ($tag{'author'} =~ m/^([^<]+) <([^>]*)>/) {
> +				$tag{'author_name'}  = $1;
> +				$tag{'author_email'} = $2;
> +			} else {
> +				$tag{'author_name'} = $tag{'author'};
> +			}
>  		} elsif ($line =~ m/--BEGIN/) {
>  			push @comment, $line;
>  			last;

Sidenote: I wonder if it would be worth doing to factor out code dealing
with extracting data from (parsing) author/committer/tagger object headers.
Probably not worth it...

> @@ -4623,11 +4629,7 @@ sub git_tag {
>  	                                      $tag{'type'}) . "</td>\n" .
>  	      "</tr>\n";
>  	if (defined($tag{'author'})) {
> -		my %ad = parse_date($tag{'epoch'}, $tag{'tz'});
> -		print "<tr><td>author</td><td>" . esc_html($tag{'author'}) . "</td></tr>\n";
> -		print "<tr><td></td><td>" . $ad{'rfc2822'} .
> -			sprintf(" (%02d:%02d %s)", $ad{'hour_local'}, $ad{'minute_local'}, $ad{'tz_local'}) .
> -			"</td></tr>\n";
> +		git_print_authorship_rows(\%tag, 'author');
>  	}
>  	print "</table>\n\n" .
>  	      "</div>\n";

I wonder why we used and use 'author' instead of 'tagger'...

-- 
Jakub Narebski
Poland