-rw-r--r-- | ui-commit.c | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/ui-commit.c b/ui-commit.c index f5b0ae5..2b4f677 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
@@ -14,9 +14,10 @@ | |||
14 | 14 | ||
15 | void cgit_print_commit(char *hex) | 15 | void cgit_print_commit(char *hex, const char *prefix) |
16 | { | 16 | { |
17 | struct commit *commit, *parent; | 17 | struct commit *commit, *parent; |
18 | struct commitinfo *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; | 22 | char *tmp, *tmp2; |
22 | int parents = 0; | 23 | int parents = 0; |
@@ -37,2 +38,4 @@ void cgit_print_commit(char *hex) | |||
37 | 38 | ||
39 | format_note(NULL, sha1, ¬es, PAGE_ENCODING, 0); | ||
40 | |||
38 | load_ref_decorations(DECORATE_FULL_REFS); | 41 | load_ref_decorations(DECORATE_FULL_REFS); |
@@ -60,5 +63,10 @@ void cgit_print_commit(char *hex) | |||
60 | tmp = sha1_to_hex(commit->object.sha1); | 63 | tmp = sha1_to_hex(commit->object.sha1); |
61 | cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp); | 64 | cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp, prefix, 0); |
62 | html(" ("); | 65 | html(" ("); |
63 | cgit_patch_link("patch", NULL, NULL, NULL, tmp); | 66 | cgit_patch_link("patch", NULL, NULL, NULL, tmp, prefix); |
67 | html(") ("); | ||
68 | if ((ctx.qry.ssdiff && !ctx.cfg.ssdiff) || (!ctx.qry.ssdiff && ctx.cfg.ssdiff)) | ||
69 | cgit_commit_link("unidiff", NULL, NULL, ctx.qry.head, tmp, prefix, 1); | ||
70 | else | ||
71 | cgit_commit_link("side-by-side diff", NULL, NULL, ctx.qry.head, tmp, prefix, 1); | ||
64 | html(")</td></tr>\n"); | 72 | html(")</td></tr>\n"); |
@@ -68,2 +76,6 @@ void cgit_print_commit(char *hex) | |||
68 | ctx.qry.head, tmp, NULL); | 76 | ctx.qry.head, tmp, NULL); |
77 | if (prefix) { | ||
78 | html(" /"); | ||
79 | cgit_tree_link(prefix, NULL, NULL, ctx.qry.head, tmp, prefix); | ||
80 | } | ||
69 | html("</td></tr>\n"); | 81 | html("</td></tr>\n"); |
@@ -79,7 +91,11 @@ void cgit_print_commit(char *hex) | |||
79 | "<td colspan='2' class='sha1'>"); | 91 | "<td colspan='2' class='sha1'>"); |
80 | cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL, | 92 | tmp = tmp2 = sha1_to_hex(p->item->object.sha1); |
81 | ctx.qry.head, sha1_to_hex(p->item->object.sha1)); | 93 | if (ctx.repo->enable_subject_links) { |
94 | parent_info = cgit_parse_commit(parent); | ||
95 | tmp2 = parent_info->subject; | ||
96 | } | ||
97 | cgit_commit_link(tmp2, NULL, NULL, ctx.qry.head, tmp, prefix, 0); | ||
82 | html(" ("); | 98 | html(" ("); |
83 | cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex, | 99 | cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex, |
84 | sha1_to_hex(p->item->object.sha1), NULL); | 100 | sha1_to_hex(p->item->object.sha1), prefix, 0); |
85 | html(")</td></tr>"); | 101 | html(")</td></tr>"); |
@@ -109,2 +125,13 @@ void cgit_print_commit(char *hex) | |||
109 | 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 | } | ||
110 | if (parents < 3) { | 137 | if (parents < 3) { |
@@ -114,4 +141,5 @@ void cgit_print_commit(char *hex) | |||
114 | tmp = NULL; | 141 | tmp = NULL; |
115 | cgit_print_diff(ctx.qry.sha1, tmp, NULL); | 142 | cgit_print_diff(ctx.qry.sha1, tmp, prefix); |
116 | } | 143 | } |
144 | strbuf_release(¬es); | ||
117 | cgit_free_commitinfo(info); | 145 | cgit_free_commitinfo(info); |