-rw-r--r-- | cgit.css | 29 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | ui-commit.c | 15 | ||||
-rw-r--r-- | ui-log.c | 12 |
4 files changed, 57 insertions, 0 deletions
@@ -159,16 +159,27 @@ table.list td.logsubject { } table.list td.logmsg { font-family: monospace; white-space: pre; padding: 1em 0.5em 2em 0.5em; } +table.list td.lognotes-label { + text-align:right; + vertical-align:top; +} + +table.list td.lognotes { + font-family: monospace; + white-space: pre; + padding: 0em 0.5em 2em 0.5em; +} + table.list td a { color: black; } table.list td a.ls-dir { font-weight: bold; color: #00f; } @@ -321,16 +332,34 @@ div.commit-subject { padding: 0em; } div.commit-msg { white-space: pre; font-family: monospace; } +div.notes-header { + font-weight: bold; + padding-top: 1.5em; +} + +div.notes { + white-space: pre; + font-family: monospace; + border: solid 1px #ee9; + background-color: #ffd; + padding: 0.3em 2em 0.3em 1em; + float: left; +} + +div.notes-footer { + clear: left; +} + div.diffstat-header { font-weight: bold; padding-top: 1.5em; } table.diffstat { border-collapse: collapse; border: solid 1px #aaa; @@ -14,16 +14,17 @@ #include <refs.h> #include <revision.h> #include <log-tree.h> #include <archive.h> #include <string-list.h> #include <xdiff-interface.h> #include <xdiff/xdiff.h> #include <utf8.h> +#include <notes.h> /* * Dateformats used on misc. pages */ #define FMT_LONGDATE "%Y-%m-%d %H:%M:%S (%Z)" #define FMT_SHORTDATE "%Y-%m-%d" #define FMT_ATOMDATE "%Y-%m-%dT%H:%M:%SZ" diff --git a/ui-commit.c b/ui-commit.c index a11bc5f..45af450 100644 --- a/ui-commit.c +++ b/ui-commit.c @@ -12,16 +12,17 @@ #include "ui-diff.h" #include "ui-log.h" void cgit_print_commit(char *hex, const char *prefix) { struct commit *commit, *parent; struct commitinfo *info, *parent_info; struct commit_list *p; + struct strbuf notes = STRBUF_INIT; unsigned char sha1[20]; char *tmp, *tmp2; int parents = 0; if (!hex) hex = ctx.qry.head; if (get_sha1(hex, sha1)) { @@ -30,16 +31,18 @@ void cgit_print_commit(char *hex, const char *prefix) } commit = lookup_commit_reference(sha1); if (!commit) { cgit_print_error(fmt("Bad commit reference: %s", hex)); return; } info = cgit_parse_commit(commit); + get_commit_notes(commit, ¬es, PAGE_ENCODING, 0); + load_ref_decorations(DECORATE_FULL_REFS); html("<table summary='commit info' class='commit-info'>\n"); html("<tr><th>author</th><td>"); html_txt(info->author); if (!ctx.cfg.noplainemail) { html(" "); html_txt(info->author_email); @@ -115,17 +118,29 @@ void cgit_print_commit(char *hex, const char *prefix) html("</div>"); html("<div class='commit-msg'>"); if (ctx.repo->commit_filter) cgit_open_filter(ctx.repo->commit_filter); html_txt(info->msg); if (ctx.repo->commit_filter) cgit_close_filter(ctx.repo->commit_filter); html("</div>"); + if (notes.len != 0) { + html("<div class='notes-header'>Notes</div>"); + html("<div class='notes'>"); + if (ctx.repo->commit_filter) + cgit_open_filter(ctx.repo->commit_filter); + html_txt(notes.buf); + if (ctx.repo->commit_filter) + cgit_close_filter(ctx.repo->commit_filter); + html("</div>"); + html("<div class='notes-footer'></div>"); + } if (parents < 3) { if (parents) tmp = sha1_to_hex(commit->parents->item->object.sha1); else tmp = NULL; cgit_print_diff(ctx.qry.sha1, tmp, prefix); } + strbuf_release(¬es); cgit_free_commitinfo(info); } @@ -106,25 +106,37 @@ void print_commit(struct commit *commit) htmlf("%d", files); if (ctx.repo->enable_log_linecount) { html("</td><td>"); htmlf("-%d/+%d", rem_lines, add_lines); } } html("</td></tr>\n"); if (ctx.qry.showmsg) { + struct strbuf notes = STRBUF_INIT; + get_commit_notes(commit, ¬es, PAGE_ENCODING, 0); + if (ctx.repo->enable_log_filecount) { cols++; if (ctx.repo->enable_log_linecount) cols++; } htmlf("<tr class='nohover'><td/><td colspan='%d' class='logmsg'>", cols); html_txt(info->msg); html("</td></tr>\n"); + if (notes.len != 0) { + html("<tr class='nohover'>"); + html("<td class='lognotes-label'>Notes:</td>"); + htmlf("<td colspan='%d' class='lognotes'>", + cols); + html_txt(notes.buf); + html("</td></tr>\n"); + } + strbuf_release(¬es); } cgit_free_commitinfo(info); } static const char *disambiguate_ref(const char *ref) { unsigned char sha1[20]; const char *longref; |