From e19c1741f5d9668abdb48ac387f5dfcc34f982fd Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 4 Feb 2010 16:09:44 +0100 Subject: [PATCH] gitweb: show notes in commit(diff) view The notes are shown side-by-side along the bottom of the commit message. --- gitweb/gitweb.css | 11 +++++++++++ gitweb/gitweb.perl | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css index 81d66d34ea..10acab4336 100644 --- a/gitweb/gitweb.css +++ b/gitweb/gitweb.css @@ -145,6 +145,7 @@ div.list_head { border: solid #d9d8d1; border-width: 1px 0px 0px; font-style: italic; + clear: both; } .author_date, .author { @@ -612,3 +613,13 @@ div.notes div.note { border:1px solid #c9bb83; padding:4px;margin:0; } + + +div.page_body div.notes { + max-width:100%; + float:none; +} + +div.page_body div.notes div.note { + float:left; +} diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 0ab6ae97ab..f9599ee7ec 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2843,12 +2843,31 @@ sub parse_commit { %co = parse_commit_text(<$fd>, 1); close $fd; + my %notes = (); + foreach my $note_ref (get_note_refs()) { + my $obj = "$note_ref:$co{'id'}"; + if (open my $fd, '-|', git_cmd(), 'rev-parse', + '--verify', '-q', $obj) { + my $exists = <$fd>; + close $fd; + if (defined $exists) { + if (open $fd, '-|', git_cmd(), 'show', $obj) { + $notes{$note_ref} = scalar <$fd>; + close $fd; + } + } + } + } + $co{'notes'} = \%notes; + return %co; } # return all refs matching refs/notes/ where the globspecs # are taken from the notes feature content. sub get_note_refs { + local $/ = ""; + my @globs = gitweb_get_feature('notes'); my @note_refs = (); foreach my $glob (@globs) { @@ -5881,6 +5900,7 @@ sub git_commit { print "
\n"; git_print_log($co{'comment'}); + print format_notes_html($co{'notes'}, 'div'); print "
\n"; git_difftree_body(\@difftree, $hash, @$parents); @@ -6236,6 +6256,7 @@ sub git_commitdiff { git_print_log($co{'comment'}, -final_empty_line=> 1, -remove_title => 1); print "\n"; # class="log" } + print format_notes_html($co{'notes'}, 'div'); } elsif ($format eq 'plain') { my $refs = git_get_references("tags"); -- 2.32.0.93.g670b81a890