Re: [PATCH 3/4] gitweb: show notes in log
From: Jakub Narebski <hidden>
Date: 2016-06-15 22:48:11
On Thu, 4 Feb 2010, Giuseppe Bilotta wrote:
The notes are shown in full to the left of the log message.
Thats all good if you have wide (high resolution) screen, and your project follows common commit message conventions of keeping lines in commit message no longer than at most 80 characters, and you don't need to use large size fonts. What happens if screen size is too small to contain both commit message and notes? Does it do the sensible thing of putting notes _below_ commit message in such situation? I do not know CSS+HTML enogh to answer this question myself. BTW. signoff? P.S. We would probably want some support for notes also in feeds (Atom and RSS feed), but this can be left for the future commit.
quoted hunk ↗ jump to hunk
@@ -1631,6 +1631,7 @@ sub format_subject_html { # display notes next to a commit sub format_notes_html { my %notes = %{$_[0]}; + my $tag = $_[1] || 'span' ;
This could be my $notes = shift; my $tag = shift || 'span' ; and then use %$notes.
quoted hunk ↗ jump to hunk
my $ret = ""; while (my ($ref, $text) = each %notes) { # remove 'refs/notes/' and an optional final s@@ -1639,15 +1640,15 @@ sub format_notes_html { # double markup is needed to allow pure CSS cross-browser 'popup' # of the note - $ret .= "<span title='$ref' class='note-container $ref'>"; - $ret .= "<span title='$ref' class='note $ref'>"; + $ret .= "<$tag title='$ref' class='note-container $ref'>"; + $ret .= "<$tag title='$ref' class='note $ref'>"; foreach my $line (split /\n/, $text) { $ret .= esc_html($line) . "<br/>"; } - $ret .= "</span></span>"; + $ret .= "</$tag></$tag>"; } if ($ret) { - return "<span class='notes'>$ret</span>"; + return "<$tag class='notes'>$ret</$tag>"; } else { return $ret; }
Nice trick, but is this distinction really necessary?
quoted hunk ↗ jump to hunk
@@ -4581,6 +4582,7 @@ sub git_log_body { next if !%co; my $commit = $co{'id'}; my $ref = format_ref_marker($refs, $commit); + my $notes = format_notes_html($co{'notes'}, 'div'); my %ad = parse_date($co{'author_epoch'}); git_print_header_div('commit', "<span class=\"age\">$co{'age_string'}</span>" .@@ -4598,6 +4600,7 @@ sub git_log_body { git_print_authorship(\%co, -tag => 'span'); print "<br/>\n</div>\n"; + print "$notes\n"; print "<div class=\"log_body\">\n"; git_print_log($co{'comment'}, -final_empty_line=> 1); print "</div>\n";
With respect to the question about what happens if the screen is not wide enough, shouldn't notes be put in HTML source below body (commit message)? -- Jakub Narebski Poland