summaryrefslogtreecommitdiffabout
authorJeff Smith <whydoubt@yahoo.com>2010-07-29 14:32:30 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2010-08-04 01:10:07 (UTC)
commit059b39344fdcde324dff1099fc4b70c7aab12a96 (patch) (unidiff)
tree4a12cf7645b89c06684e09a1e5dded9a5ddeae38
parentf9143171267e39f66a02ad2ecb0da2e8cc7f4142 (diff)
downloadcgit-059b39344fdcde324dff1099fc4b70c7aab12a96.zip
cgit-059b39344fdcde324dff1099fc4b70c7aab12a96.tar.gz
cgit-059b39344fdcde324dff1099fc4b70c7aab12a96.tar.bz2
ui-commit: Display git notes when present
Signed-off-by: Jeff Smith <whydoubt@yahoo.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--cgit.css18
-rw-r--r--cgit.h1
-rw-r--r--ui-commit.c15
3 files changed, 34 insertions, 0 deletions
diff --git a/cgit.css b/cgit.css
index 6e47eb3..3675697 100644
--- a/cgit.css
+++ b/cgit.css
@@ -326,6 +326,24 @@ div.commit-msg {
326 font-family: monospace; 326 font-family: monospace;
327} 327}
328 328
329div.notes-header {
330 font-weight: bold;
331 padding-top: 1.5em;
332}
333
334div.notes {
335 white-space: pre;
336 font-family: monospace;
337 border: solid 1px #ee9;
338 background-color: #ffd;
339 padding: 0.3em 2em 0.3em 1em;
340 float: left;
341}
342
343div.notes-footer {
344 clear: left;
345}
346
329div.diffstat-header { 347div.diffstat-header {
330 font-weight: bold; 348 font-weight: bold;
331 padding-top: 1.5em; 349 padding-top: 1.5em;
diff --git a/cgit.h b/cgit.h
index e9e2718..32d9d2b 100644
--- a/cgit.h
+++ b/cgit.h
@@ -19,6 +19,7 @@
19#include <xdiff-interface.h> 19#include <xdiff-interface.h>
20#include <xdiff/xdiff.h> 20#include <xdiff/xdiff.h>
21#include <utf8.h> 21#include <utf8.h>
22#include <notes.h>
22 23
23 24
24/* 25/*
diff --git a/ui-commit.c b/ui-commit.c
index a11bc5f..45af450 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -17,6 +17,7 @@ void cgit_print_commit(char *hex, const char *prefix)
17 struct commit *commit, *parent; 17 struct commit *commit, *parent;
18 struct commitinfo *info, *parent_info; 18 struct commitinfo *info, *parent_info;
19 struct commit_list *p; 19 struct commit_list *p;
20 struct strbuf notes = STRBUF_INIT;
20 unsigned char sha1[20]; 21 unsigned char sha1[20];
21 char *tmp, *tmp2; 22 char *tmp, *tmp2;
22 int parents = 0; 23 int parents = 0;
@@ -35,6 +36,8 @@ void cgit_print_commit(char *hex, const char *prefix)
35 } 36 }
36 info = cgit_parse_commit(commit); 37 info = cgit_parse_commit(commit);
37 38
39 get_commit_notes(commit, &notes, PAGE_ENCODING, 0);
40
38 load_ref_decorations(DECORATE_FULL_REFS); 41 load_ref_decorations(DECORATE_FULL_REFS);
39 42
40 html("<table summary='commit info' class='commit-info'>\n"); 43 html("<table summary='commit info' class='commit-info'>\n");
@@ -120,6 +123,17 @@ void cgit_print_commit(char *hex, const char *prefix)
120 if (ctx.repo->commit_filter) 123 if (ctx.repo->commit_filter)
121 cgit_close_filter(ctx.repo->commit_filter); 124 cgit_close_filter(ctx.repo->commit_filter);
122 html("</div>"); 125 html("</div>");
126 if (notes.len != 0) {
127 html("<div class='notes-header'>Notes</div>");
128 html("<div class='notes'>");
129 if (ctx.repo->commit_filter)
130 cgit_open_filter(ctx.repo->commit_filter);
131 html_txt(notes.buf);
132 if (ctx.repo->commit_filter)
133 cgit_close_filter(ctx.repo->commit_filter);
134 html("</div>");
135 html("<div class='notes-footer'></div>");
136 }
123 if (parents < 3) { 137 if (parents < 3) {
124 if (parents) 138 if (parents)
125 tmp = sha1_to_hex(commit->parents->item->object.sha1); 139 tmp = sha1_to_hex(commit->parents->item->object.sha1);
@@ -127,5 +141,6 @@ void cgit_print_commit(char *hex, const char *prefix)
127 tmp = NULL; 141 tmp = NULL;
128 cgit_print_diff(ctx.qry.sha1, tmp, prefix); 142 cgit_print_diff(ctx.qry.sha1, tmp, prefix);
129 } 143 }
144 strbuf_release(&notes);
130 cgit_free_commitinfo(info); 145 cgit_free_commitinfo(info);
131} 146}