[PATCH 4/4] gitweb: show notes in commit(diff) view

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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(+), 0 deletions(-)

diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
index 81d66d3..10acab4 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 0d0877e..0d03026 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2837,12 +2837,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/<globspecs> 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) {
@@ -5875,6 +5894,7 @@ sub git_commit {
 
 	print "<div class=\"page_body\">\n";
 	git_print_log($co{'comment'});
+	print format_notes_html($co{'notes'}, 'div');
 	print "</div>\n";
 
 	git_difftree_body(\@difftree, $hash, @$parents);
@@ -6230,6 +6250,7 @@ sub git_commitdiff {
 			git_print_log($co{'comment'}, -final_empty_line=> 1, -remove_title => 1);
 			print "</div>\n"; # class="log"
 		}
+		print format_notes_html($co{'notes'}, 'div');
 
 	} elsif ($format eq 'plain') {
 		my $refs = git_get_references("tags");
-- 
1.7.0.rc1.193.ge8618

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]