gitweb: avatar support
v8 cover gitweb: avatar support
8th iteration of my attempt to implement avatar support for gitweb. Only minor changes from the previous version: the removal of a couple of patches that need to be discussed some more, and some tune-up suggested by Jakub.
Giuseppe Bilotta (7):
gitweb: refactor author name insertion
gitweb: uniform author info for commit and commitdiff
gitweb: use git_print_authorship_rows in 'tag' view too
gitweb: (gr)avatar support
gitweb: gravatar url cache
gitweb: picon avatar provider
gitweb: add empty alt text to avatar img
gitweb/gitweb.css | 9 +- gitweb/gitweb.perl | 231 +++++++++++++++++++++++++------ t/t9500-gitweb-standalone-no-errors.sh | 2 + 3 files changed, 196 insertions(+), 46 deletions(-)
PATCH v8 1/7 gitweb: refactor author name insertion
Collect all author display code in appropriate functions, making it easier to extend these functions on the CGI side.
We also move some of the presentation code from hard-coded HTML to CSS, for easier customization.
A side effect of the refactoring is that now localtime is always displayed with the 'at night' warning.
--- gitweb/gitweb.css | 5 ++- gitweb/gitweb.perl | 93 ++++++++++++++++++++++++++++++--------------------- 2 files changed, 59 insertions(+), 39 deletions(-)
gitweb/gitweb.css +4 -1
@@ -132,11 +132,14 @@ div.list_head { font-style: italic; } +.author_date, .author { + font-style: italic; +} + div.author_date { padding: 8px; border: solid #d9d8d1; border-width: 0px 0px 1px 0px; - font-style: italic; } a.list {
gitweb/gitweb.perl +55 -38
159 lines not on this page · raw message
Signature · 1 line
1.6.3.rc1.192.gdbfcb
PATCH v8 2/7 gitweb: uniform author info for commit and commitdiff
Switch from 'log'-like layout
A U Thor <[email protected]> [date time]
to 'commit'-like layout
author A U Thor <[email protected]>
date time
committer C O Mitter <[email protected]>
committer date time
--- gitweb/gitweb.perl | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
gitweb/gitweb.perl +5 -1
@@ -5596,7 +5596,11 @@ sub git_commitdiff { git_header_html(undef, $expires); git_print_page_nav('commitdiff','', $hash,$co{'tree'},$hash, $formats_nav); git_print_header_div('commit', esc_html($co{'title'}) . $ref, $hash); - git_print_authorship(\%co, -localtime => 1); + print "<div class=\"title_text\">\n" . + "<table class=\"object_header\">\n"; + git_print_authorship_rows(\%co); + print "</table>". + "</div>\n"; print "<div class=\"page_body\">\n"; if (@{$co{'comment'}} > 1) { print "<div class=\"log\">\n";
Signature · 1 line
1.6.3.rc1.192.gdbfcb
PATCH v8 3/7 gitweb: use git_print_authorship_rows in 'tag' view too
parse_tag must be adapted to use the hash keys expected by git_print_authorship_rows. This is not a problem since git_tag is the only user of this sub.
--- gitweb/gitweb.perl | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-)
gitweb/gitweb.perl +9 -7
@@ -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;
@@ -4620,11 +4626,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";
Signature · 1 line
1.6.3.rc1.192.gdbfcb
PATCH v8 4/7 gitweb: (gr)avatar support
Introduce avatar support: the feature adds the appropriate img tag next to author and committer in commit(diff), history, shortlog, log and tag views. Multiple avatar providers are possible, but only gravatar is implemented at the moment.
Gravatar support depends on Digest::MD5, which is a core package since Perl 5.8. If gravatars are activated but Digest::MD5 cannot be found, the feature will be automatically disabled.
No avatar provider is selected by default, except in the t9500 test.
--- gitweb/gitweb.css | 4 ++ gitweb/gitweb.perl | 83 ++++++++++++++++++++++++++++++- t/t9500-gitweb-standalone-no-errors.sh | 2 + 3 files changed, 86 insertions(+), 3 deletions(-)
gitweb/gitweb.css +4 -0
@@ -28,6 +28,10 @@ img.logo { border-width: 0px; } +img.avatar { + vertical-align: middle; +} + div.page_header { height: 25px; padding: 8px;
gitweb/gitweb.perl +80 -3
131 lines not on this page · raw message
t/t9500-gitweb-standalone-no-errors.sh +2 -0
@@ -660,6 +660,7 @@ cat >>gitweb_config.perl <<EOF \$feature{'blame'}{'override'} = 1; \$feature{'snapshot'}{'override'} = 1; +\$feature{'avatar'}{'override'} = 1; EOF test_expect_success \
@@ -671,6 +672,7 @@ test_expect_success \ 'config override: tree view, features disabled in repo config' \ 'git config gitweb.blame no && git config gitweb.snapshot none && + git config gitweb.avatar gravatar && gitweb_run "p=.git;a=tree"' test_debug 'cat gitweb.log'
Signature · 1 line
1.6.3.rc1.192.gdbfcb
PATCH v8 5/7 gitweb: gravatar url cache
Views which contain many occurrences of the same email address (e.g. shortlog view) benefit from not having to recalculate the MD5 of the email address every time.
--- gitweb/gitweb.perl | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-)
gitweb/gitweb.perl +22 -2
@@ -1512,6 +1512,27 @@ sub format_subject_html { } } +# Rather than recomputing the url for an email multiple times, we cache it +# after the first hit. This gives a visible benefit in views where the avatar +# for the same email is used repeatedly (e.g. shortlog). +# The cache is shared by all avatar engines (currently gravatar only), which +# are free to use it as preferred. Since only one avatar engine is used for any +# given page, there's no risk for cache conflicts. +our %avatar_cache = (); + +# Compute the gravatar url for a given email, if it's not in the cache already. +# Gravatar stores only the part of the URL before the size, since that's the +# one computationally more expensive. This also allows reuse of the cache for +# different sizes (for this particular engine). +sub gravatar_url { + my $email = lc shift; + my $size = shift; + $avatar_cache{$email} ||= + "http://www.gravatar.com/avatar/" . + Digest::MD5::md5_hex($email) . "?s="; + return $avatar_cache{$email} . $size; +} + # Insert an avatar for the given $email at the given $size if the feature # is enabled. sub git_get_avatar {
@@ -1522,8 +1543,7 @@ sub git_get_avatar { my $size = $avatar_size{$opts{-size}} || $avatar_size{'default'}; my $url = ""; if ($git_avatar eq 'gravatar') { - $url = "http://www.gravatar.com/avatar/" . - Digest::MD5::md5_hex(lc $email) . "?s=$size"; + $url = gravatar_url($email, $size); } # Currently only gravatars are supported, but other forms such as # picons can be added by putting an else up here and defining $url
Signature · 1 line
1.6.3.rc1.192.gdbfcb
PATCH v8 6/7 gitweb: picon avatar provider
Simple implementation of picon that only relies on the indiana.edu database.
--- gitweb/gitweb.perl | 34 +++++++++++++++++++++++++++------- 1 files changed, 27 insertions(+), 7 deletions(-)
gitweb/gitweb.perl +27 -7
@@ -378,15 +378,18 @@ our %feature = ( # shortlog or commit will display an avatar associated with # the email of the committer(s) and/or author(s). - # Currently only the gravatar provider is available, and it - # depends on Digest::MD5. If an unknown provider is specified, - # the feature is disabled. + # Currently available providers are gravatar and picon. + # If an unknown provider is specified, the feature is disabled. + + # Gravatar depends on Digest::MD5. + # Picon currently relies on the indiana.edu database. # To enable system wide have in $GITWEB_CONFIG - # $feature{'avatar'}{'default'} = ['gravatar']; + # $feature{'avatar'}{'default'} = ['<provider>']; + # where <provider> is either gravatar or picon. # To have project specific config enable override in $GITWEB_CONFIG # $feature{'avatar'}{'override'} = 1; - # and in project config gitweb.avatar = gravatar; + # and in project config gitweb.avatar = <provider>; 'avatar' => { 'sub' => \&feature_avatar, 'override' => 0,
@@ -853,6 +856,8 @@ our @snapshot_fmts = gitweb_get_feature('snapshot'); our ($git_avatar) = gitweb_get_feature('avatar'); if ($git_avatar eq 'gravatar') { $git_avatar = '' unless (eval { require Digest::MD5; 1; }); +} elsif ($git_avatar eq 'picon') { + # no dependencies } else { $git_avatar = ''; }
@@ -1520,6 +1525,20 @@ sub format_subject_html { # given page, there's no risk for cache conflicts. our %avatar_cache = (); +# Compute the picon url for a given email, by using the picon search service over at +# http://www.cs.indiana.edu/picons/search.html +sub picon_url { + my $email = lc shift; + if (!$avatar_cache{$email}) { + my ($user, $domain) = split('@', $email); + $avatar_cache{$email} = + "http://www.cs.indiana.edu/cgi-pub/kinzler/piconsearch.cgi/" . + "$domain/$user/" . + "users+domains+unknown/up/single"; + } + return $avatar_cache{$email}; +} + # Compute the gravatar url for a given email, if it's not in the cache already. # Gravatar stores only the part of the URL before the size, since that's the # one computationally more expensive. This also allows reuse of the cache for
@@ -1544,9 +1563,10 @@ sub git_get_avatar { my $url = ""; if ($git_avatar eq 'gravatar') { $url = gravatar_url($email, $size); + } elsif ($git_avatar eq 'picon') { + $url = picon_url($email); } - # Currently only gravatars are supported, but other forms such as - # picons can be added by putting an else up here and defining $url + # Other providers can be added by extending the if chain, defining $url # as needed. If no variant puts something in $url, we assume avatars # are completely disabled/unavailable. if ($url) {
Signature · 1 line
1.6.3.rc1.192.gdbfcb
PATCH v8 7/7 gitweb: add empty alt text to avatar img
The empty alt text optimizes screen estate in text-only browsers.
--- gitweb/gitweb.perl | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
gitweb/gitweb.perl +1 -0
@@ -1574,6 +1574,7 @@ sub git_get_avatar { "<img width=\"$size\" " . "class=\"avatar\" " . "src=\"$url\" " . + "alt=\"\" " . "/>" . $post_white; } else { return "";
Signature · 1 line
1.6.3.rc1.192.gdbfcb
Re: [PATCHv8 7/7] gitweb: add empty alt text to avatar img
Quoted 3 lines · Giuseppe Bilotta
The empty alt text optimizes screen estate in text-only browsers.
Signed-off-by Giuseppe Bilotta <[email protected]>
I am not sure if such alt-text is a good idea from standards point of view. But the reasoning seems sound.
Quoted 20 lines
--- gitweb/gitweb.perl | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)gitweb/gitweb.perl +1
-0@@ -1574,6 +1574,7 @@ sub git_get_avatar { "<img width=\"$size\" " . "class=\"avatar\" " . "src=\"$url\" " . + "alt=\"\" " . "/>" . $post_white; } else { return "";Signature · 1 line
1.6.3.rc1.192.gdbfcb
Signature · 2 lines
Jakub Narebski Poland
Re: [PATCHv8 6/7] gitweb: picon avatar provider
In reply to Giuseppe BilottaQuoted 4 lines · Giuseppe Bilotta
Simple implementation of picon that only relies on the indiana.edu database.
Signed-off-by Giuseppe Bilotta <[email protected]>
Well written, and nice example how to add other avatar providers.
[...]
Quoted 8 lines
gitweb/gitweb.perl +5
-3- # Currently only the gravatar provider is available, and it - # depends on Digest::MD5. If an unknown provider is specified, - # the feature is disabled. + # Currently available providers are gravatar and picon. + # If an unknown provider is specified, the feature is disabled. + + # Gravatar depends on Digest::MD5. + # Picon currently relies on the indiana.edu database.
[...]
gitweb/gitweb.perl sub git_get_avatar { · line 1571
Quoted 5 lines
gitweb/gitweb.perl +1
-2- # Currently only gravatars are supported, but other forms such as - # picons can be added by putting an else up here and defining $url + # Other providers can be added by extending the if chain, defining $url # as needed. If no variant puts something in $url, we assume avatars # are completely disabled/unavailable.
I see that you have updated comments too.
Signature · 2 lines
Jakub Narebski Poland
Re: [PATCHv8 6/7] gitweb: picon avatar provider
2009/6/30 Jakub Narebski <[email protected]>:
Quoted 8 lines · Giuseppe Bilotta
Quoted 5 lines
- # Currently only gravatars are supported, but other forms such as
- # picons can be added by putting an else up here and defining $url
+ # Other providers can be added by extending the if chain, defining $url# as needed. If no variant puts something in $url, we assume avatars # are completely disabled/unavailable.I see that you have updated comments too.
Well, I tried to address all the points that were raised during review 8-)
Signature · 1 line
Giuseppe "Oblomov" Bilotta
Re: [PATCHv8 5/7] gitweb: gravatar url cache
In reply to Giuseppe BilottaQuoted 5 lines · Giuseppe Bilotta
Views which contain many occurrences of the same email address (e.g. shortlog view) benefit from not having to recalculate the MD5 of the email address every time.
Signed-off-by Giuseppe Bilotta <[email protected]>
Very nice, very well written.
Signature · 2 lines
Jakub Narebski Poland
Re: [PATCHv8 5/7] gitweb: gravatar url cache
In reply to Giuseppe Bilottagitweb/gitweb.perl sub format_subject_html { · line 1520
Quoted 6 lines · Giuseppe Bilotta
gitweb/gitweb.perl +6
-0+# Rather than recomputing the url for an email multiple times, we cache it +# after the first hit. This gives a visible benefit in views where the avatar +# for the same email is used repeatedly (e.g. shortlog). +# The cache is shared by all avatar engines (currently gravatar only), which +# are free to use it as preferred. Since only one avatar engine is used for any +# given page, there's no risk for cache conflicts.
Is it "any given page", or "any given e-mail"?
Re: [PATCHv8 5/7] gitweb: gravatar url cache
Quoted 10 lines · Junio C Hamano
gitweb/gitweb.perl sub format_subject_html { · line 1520
Quoted 6 lines · Giuseppe Bilotta
gitweb/gitweb.perl +6
-0+# Rather than recomputing the url for an email multiple times, we cache it +# after the first hit. This gives a visible benefit in views where the avatar +# for the same email is used repeatedly (e.g. shortlog). +# The cache is shared by all avatar engines (currently gravatar only), which +# are free to use it as preferred. Since only one avatar engine is used for any +# given page, there's no risk for cache conflicts.Is it "any given page", or "any given e-mail"?
It's 'page' as in HTML file served by the script. I couldn't find a better way to express that.
Signature · 1 line
Giuseppe "Oblomov" Bilotta
Re: [PATCHv8 4/7] gitweb: (gr)avatar support
In reply to Giuseppe BilottaQuoted 5 lines · Giuseppe Bilotta
Introduce avatar support: the feature adds the appropriate img tag next to author and committer in commit(diff), history, shortlog, log and tag views. Multiple avatar providers are possible, but only gravatar is implemented at the moment.
Quoted 7 lines
Gravatar support depends on
Digest::MD5, which is a core package since Perl 5.8. If gravatars are activated butDigest::MD5cannot be found, the feature will be automatically disabled.No avatar provider is selected by default, except in the t9500 test.
Signed-off-by Giuseppe Bilotta <[email protected]>
I like both commit message and comprehensive comments.
[...]
gitweb/gitweb.perl sub format_subject_html { · line 1527
Quoted 13 lines
gitweb/gitweb.perl +13
-0+# Insert an avatar for the given $email at the given $size if the feature +# is enabled. +sub git_get_avatar { + my ($email, %opts) = @_; + my $pre_white = ($opts{-pad_before} ? " " : ""); + my $post_white = ($opts{-pad_after} ? " " : ""); + $opts{-size} ||= 'default'; + my $size = $avatar_size{$opts{-size}} || $avatar_size{'default'}; + my $url = ""; + if ($git_avatar eq 'gravatar') { + $url = "http://www.gravatar.com/avatar/" . + Digest::MD5::md5_hex(lc $email) . "?s=$size"; + }
I guess that you use short form 's' instead of 'size' to make URL (and therefore gitweb pages) shorter, isn't it?
gitweb/gitweb.perl sub format_subject_html { · line 1537
Quoted 10 lines
gitweb/gitweb.perl +10
-0+ # Currently only gravatars are supported, but other forms such as + # picons can be added by putting an else up here and defining $url + # as needed. If no variant puts something in $url, we assume avatars + # are completely disabled/unavailable. + if ($url) { + return $pre_white . + "<img width=\"$size\" " . + "class=\"avatar\" " . + "src=\"$url\" " . + "/>" . $post_white;
Nitpicky sidenote: it might be more readable to use qq( ... ) quote-like operator to avoid need to escape \" while providing variable interpolation. But on the other hand it might not: this is more obscure Perl operator.
Nevertheless it is not something to worry about (and certainly not something that would require resend).
Quoted 65 lines
gitweb/gitweb.perl +14
-3+ } else { + return ""; + } +} + # format the author name of the given commit with the given tag # the author name is chopped and escaped according to the other # optional parameters (see chop_str).@@ -1476,7 +1547,9 @@ sub format_author_html { my $tag = shift; my $co = shift; my $author = chop_and_escape_str($co->{'author_name'}, @_); - return "<$tag class=\"author\">" . $author . "</$tag>"; + return "<$tag class=\"author\">" . + git_get_avatar($co->{'author_email'}, -pad_after => 1) . + $author . "</$tag>"; } # format git diff header line, i.e. "diff --(git|combined|cc) ..."@@ -3252,7 +3325,8 @@ sub git_print_authorship { esc_html($co->{'author_name'}) . " [$ad{'rfc2822'}"; print_local_time(%ad) if ($opts{-localtime}); - print "]</$tag>\n"; + print "]" . git_get_avatar($co->{'author_email'}, -pad_before => 1) + . "</$tag>\n"; } # Outputs table rows containing the full author or committer information,@@ -3267,7 +3341,10 @@ sub git_print_authorship_rows { @people = ('author', 'committer') unless @people; foreach my $who (@people) { my %wd = parse_date($co->{"${who}_epoch"}, $co->{"${who}_tz"}); - print "<tr><td>$who</td><td>" . esc_html($co->{$who}) . "</td></tr>\n". + print "<tr><td>$who</td><td>" . esc_html($co->{$who}) . "</td>" . + "<td rowspan=\"2\">" . + git_get_avatar($co->{"${who}_email"}, -size => 'double') . + "</td></tr>\n" . "<tr>" . "<td></td><td> $wd{'rfc2822'}"; print_local_time(%wd);t/t9500-gitweb-standalone-no-errors.sh +2
-0@@ -660,6 +660,7 @@ cat >>gitweb_config.perl <<EOF \$feature{'blame'}{'override'} = 1; \$feature{'snapshot'}{'override'} = 1; +\$feature{'avatar'}{'override'} = 1; EOF test_expect_success \@@ -671,6 +672,7 @@ test_expect_success \ 'config override: tree view, features disabled in repo config' \ 'git config gitweb.blame no && git config gitweb.snapshot none && + git config gitweb.avatar gravatar && gitweb_run "p=.git;a=tree"' test_debug 'cat gitweb.log'Signature · 1 line
1.6.3.rc1.192.gdbfcb
Signature · 2 lines
Jakub Narebski Poland
Re: [PATCHv8 3/7] gitweb: use git_print_authorship_rows in 'tag' view too
In reply to Giuseppe BilottaQuoted 5 lines · Giuseppe Bilotta
parse_tagmust be adapted to use the hash keys expected bygit_print_authorship_rows. This is not a problem sincegit_tagis the only user of this sub.Signed-off-by Giuseppe Bilotta <[email protected]>
Very nice unification (of hash key names for parse_tag and parse_commit_text), and nice refactoring of common code.
[...]
Quoted 4 lines
gitweb/gitweb.perl +0
-0@@ -2409,8 +2409,14 @@ sub parse_tag { $tag{'name'} = $1; } elsif ($line =~ m/^tagger (.*) ([0-9]+) (.*)$/) { $tag{'author'} = $1;
gitweb/gitweb.perl sub parse_tag { · line 2419
Quoted 10 lines
gitweb/gitweb.perl +8
-2- $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'}; + }
Unrelated sidenote: I wonder if it would work correctly on malformed 'tagger' headers which sometimes happen... Probably not. But this is not an issue with this patch, but with gitweb in general.
Signature · 2 lines
Jakub Narebski Poland
Re: [PATCHv8 2/7] gitweb: uniform author info for commit and commitdiff
In reply to Giuseppe BilottaQuoted 4 lines · Giuseppe Bilotta
Switch from 'log'-like layout
A U Thor <[email protected]> [date time]
Quoted 8 lines
to 'commit'-like layout
author A U Thor <[email protected]>
date time
committer C O Mitter <[email protected]>
committer date timeSigned-off-by Giuseppe Bilotta <[email protected]>
I am (as I have said earlier) a bit ambivalent about this issue. But I like this patch from technical point of view.
I also like the fact that this feature is put in separate patch, so it can be accepted or rejected (or reverted) independently. Good work on refactoring!
gitweb/gitweb.perl sub git_commitdiff { · line 5597
Quoted 11 lines
--- gitweb/gitweb.perl | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)gitweb/gitweb.perl +0
-0@@ -5596,7 +5596,11 @@ sub git_commitdiff { git_header_html(undef, $expires); git_print_page_nav('commitdiff','', $hash,$co{'tree'},$hash,
$formats_nav);
gitweb/gitweb.perl sub git_commitdiff { · line 5598
Quoted 1 line
gitweb/gitweb.perl +0
-0git_print_header_div('commit', esc_html($co{'title'}) . $ref,
$hash);
Quoted 13 lines
gitweb/gitweb.perl +5
-1- git_print_authorship(\%co, -localtime => 1); + print "<div class=\"title_text\">\n" . + "<table class=\"object_header\">\n"; + git_print_authorship_rows(\%co); + print "</table>". + "</div>\n"; print "<div class=\"page_body\">\n"; if (@{$co{'comment'}} > 1) { print "<div class=\"log\">\n";Signature · 1 line
1.6.3.rc1.192.gdbfcb
Signature · 2 lines
Jakub Narebski Poland
Re: [PATCHv8 1/7] gitweb: refactor author name insertion
In reply to Giuseppe BilottaQuoted 8 lines · Giuseppe Bilotta
Collect all author display code in appropriate functions, making it easier to extend these functions on the CGI side.
We also move some of the presentation code from hard-coded HTML to CSS, for easier customization.
A side effect of the refactoring is that now localtime is always displayed with the 'at night' warning.
It is a very nice side effect, I think.
Quoted 2 lines
Signed-off-by Giuseppe Bilotta <[email protected]>
Quoted 4 lines
--- gitweb/gitweb.css | 5 ++- gitweb/gitweb.perl | 93 ++++++++++++++++++++++++++++++--------------------- 2 files changed, 59 insertions(+), 39 deletions(-)
[...]
gitweb/gitweb.perl sub git_print_header_div { · line 3236
Quoted 10 lines
gitweb/gitweb.perl +10
-0+sub print_local_time { + my %date = @_; + if ($date{'hour_local'} < 6) { + printf(" (<span class=\"atnight\">%02d:%02d</span> %s)", + $date{'hour_local'}, $date{'minute_local'}, $date{'tz_local'}); + } else { + printf(" (%02d:%02d %s)", + $date{'hour_local'}, $date{'minute_local'}, $date{'tz_local'}); + } +}
Very nice refactoring.
It could do with a comment describing its output, but it is not necessary, and IMHO not worth resend. We can always add it "in tree".
Signature · 2 lines
Jakub Narebski Poland
Re: [PATCHv8 1/7] gitweb: refactor author name insertion
2009/6/30 Jakub Narebski <[email protected]>:
Quoted 14 lines · Giuseppe Bilotta
gitweb/gitweb.perl sub git_print_header_div { · line 3236
Quoted 10 lines
gitweb/gitweb.perl +10
-0+sub print_local_time { + my %date = @_; + if ($date{'hour_local'} < 6) { + printf(" (<span class=\"atnight\">%02d:%02d</span> %s)", + $date{'hour_local'}, $date{'minute_local'}, $date{'tz_local'}); + } else { + printf(" (%02d:%02d %s)", + $date{'hour_local'}, $date{'minute_local'}, $date{'tz_local'}); + } +}Very nice refactoring.
Quoted 2 lines
It could do with a comment describing its output, but it is not necessary, and IMHO not worth resend. We can always add it "in tree".
Damn! I was sure I'd forget something ...
Signature · 1 line
Giuseppe "Oblomov" Bilotta
Re: [PATCHv8 1/7] gitweb: refactor author name insertion
Quoted 2 lines · Giuseppe Bilotta
2009/6/30 Jakub Narebski <[email protected]>:
Quoted 1 line · Giuseppe Bilotta
# prints time in local timezone, from result of parse_date # in the following format: " (HH:MM +/-tz_offset)" or " (%H:%M %z)" # with "atnight" warning when 0 <= hour_local < 6
or something like that. Or just
# prints time in local timezone, from result of parse_date
Quoted 13 lines
Quoted 13 lines
gitweb/gitweb.perl sub git_print_header_div { · line 3236
Quoted 10 lines
gitweb/gitweb.perl +10
-0+sub print_local_time { + my %date = @_; + if ($date{'hour_local'} < 6) { + printf(" (<span class=\"atnight\">%02d:%02d</span> %s)", + $date{'hour_local'}, $date{'minute_local'}, $date{'tz_local'}); + } else { + printf(" (%02d:%02d %s)", + $date{'hour_local'}, $date{'minute_local'}, $date{'tz_local'}); + } +}Very nice refactoring.
Quoted 4 lines
Quoted 2 lines
It could do with a comment describing its output, but it is not necessary, and IMHO not worth resend. We can always add it "in tree".
Damn! I was sure I'd forget something ...
Don't worry. It can be always addd later, or Junio can just squash proposed comment (see above).
Signature · 2 lines
Jakub Narebski Poland
Re: [PATCHv8 1/7] gitweb: refactor author name insertion
Quoted 11 lines · Jakub Narebski
Quoted 2 lines · Giuseppe Bilotta
2009/6/30 Jakub Narebski <[email protected]>:
Quoted 1 line · Giuseppe Bilotta
# prints time in local timezone, from result of parse_date # in the following format: " (HH:MM +/-tz_offset)" or " (%H:%M %z)" # with "atnight" warning when 0 <= hour_local < 6or something like that. Or just
# prints time in local timezone, from result of parse_date
How about
# prints time in local timezone, highlight night hours
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
gitweb/gitweb.perl +10
-0+sub print_local_time { + my %date = @_; + if ($date{'hour_local'} < 6) { + printf(" (<span class=\"atnight\">%02d:%02d</span> %s)", + $date{'hour_local'}, $date{'minute_local'}, $date{'tz_local'}); + } else { + printf(" (%02d:%02d %s)", + $date{'hour_local'}, $date{'minute_local'}, $date{'tz_local'}); + } +}
Signature · 1 line
Giuseppe "Oblomov" Bilotta
Re: [PATCHv8 1/7] gitweb: refactor author name insertion
Quoted 6 lines · Giuseppe Bilotta
Quoted 4 lines · Jakub Narebski
# prints time in local timezone, from result of parse_date # in the following format: " (HH:MM +/-tz_offset)" or " (%H:%M %z)" # with "atnight" warning when 0 <= hour_local < 6
Quoted 7 lines
Quoted 3 lines
or something like that. Or just
# prints time in local timezone, from result of parse_dateHow about
# prints time in local timezone, highlight night hours
Or
# prints local part of parse_date, highlight night hours
It important, I think, to state that print_local_time takes result of parse_date as an argument.
Nevertheless that is just nitpicking and bikeshedding.
Quoted 14 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
gitweb/gitweb.perl +10
-0+sub print_local_time { + my %date = @_; + if ($date{'hour_local'} < 6) { + printf(" (<span class=\"atnight\">%02d:%02d</span> %s)", + $date{'hour_local'}, $date{'minute_local'}, $date{'tz_local'}); + } else { + printf(" (%02d:%02d %s)", + $date{'hour_local'}, $date{'minute_local'}, $date{'tz_local'}); + } +}Signature · 1 line
Giuseppe "Oblomov" Bilotta
Signature · 2 lines
Jakub Narebski Poland