|
diff --git a/ui-log.c b/ui-log.c index ee93653..7f38d2a 100644 --- a/ ui-log.c+++ b/ ui-log.c |
|
@@ -82,73 +82,85 @@ void print_commit(struct commit *commit) |
82 | char *tmp; |
82 | char *tmp; |
83 | int cols = 2; |
83 | int cols = 2; |
84 | |
84 | |
85 | info = cgit_parse_commit(commit); |
85 | info = cgit_parse_commit(commit); |
86 | htmlf("<tr%s><td>", |
86 | htmlf("<tr%s><td>", |
87 | ctx.qry.showmsg ? " class='logheader'" : ""); |
87 | ctx.qry.showmsg ? " class='logheader'" : ""); |
88 | tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1)); |
88 | tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1)); |
89 | tmp = cgit_fileurl(ctx.repo->url, "commit", ctx.qry.vpath, tmp); |
89 | tmp = cgit_fileurl(ctx.repo->url, "commit", ctx.qry.vpath, tmp); |
90 | html_link_open(tmp, NULL, NULL); |
90 | html_link_open(tmp, NULL, NULL); |
91 | cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); |
91 | cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); |
92 | html_link_close(); |
92 | html_link_close(); |
93 | htmlf("</td><td%s>", |
93 | htmlf("</td><td%s>", |
94 | ctx.qry.showmsg ? " class='logsubject'" : ""); |
94 | ctx.qry.showmsg ? " class='logsubject'" : ""); |
95 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, |
95 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, |
96 | sha1_to_hex(commit->object.sha1), ctx.qry.vpath, 0); |
96 | sha1_to_hex(commit->object.sha1), ctx.qry.vpath, 0); |
97 | show_commit_decorations(commit); |
97 | show_commit_decorations(commit); |
98 | html("</td><td>"); |
98 | html("</td><td>"); |
99 | html_txt(info->author); |
99 | html_txt(info->author); |
100 | if (ctx.repo->enable_log_filecount) { |
100 | if (ctx.repo->enable_log_filecount) { |
101 | files = 0; |
101 | files = 0; |
102 | add_lines = 0; |
102 | add_lines = 0; |
103 | rem_lines = 0; |
103 | rem_lines = 0; |
104 | cgit_diff_commit(commit, inspect_files); |
104 | cgit_diff_commit(commit, inspect_files); |
105 | html("</td><td>"); |
105 | html("</td><td>"); |
106 | htmlf("%d", files); |
106 | htmlf("%d", files); |
107 | if (ctx.repo->enable_log_linecount) { |
107 | if (ctx.repo->enable_log_linecount) { |
108 | html("</td><td>"); |
108 | html("</td><td>"); |
109 | htmlf("-%d/+%d", rem_lines, add_lines); |
109 | htmlf("-%d/+%d", rem_lines, add_lines); |
110 | } |
110 | } |
111 | } |
111 | } |
112 | html("</td></tr>\n"); |
112 | html("</td></tr>\n"); |
113 | if (ctx.qry.showmsg) { |
113 | if (ctx.qry.showmsg) { |
| |
114 | struct strbuf notes = STRBUF_INIT; |
| |
115 | get_commit_notes(commit, ¬es, PAGE_ENCODING, 0); |
| |
116 | |
114 | if (ctx.repo->enable_log_filecount) { |
117 | if (ctx.repo->enable_log_filecount) { |
115 | cols++; |
118 | cols++; |
116 | if (ctx.repo->enable_log_linecount) |
119 | if (ctx.repo->enable_log_linecount) |
117 | cols++; |
120 | cols++; |
118 | } |
121 | } |
119 | htmlf("<tr class='nohover'><td/><td colspan='%d' class='logmsg'>", |
122 | htmlf("<tr class='nohover'><td/><td colspan='%d' class='logmsg'>", |
120 | cols); |
123 | cols); |
121 | html_txt(info->msg); |
124 | html_txt(info->msg); |
122 | html("</td></tr>\n"); |
125 | html("</td></tr>\n"); |
| |
126 | if (notes.len != 0) { |
| |
127 | html("<tr class='nohover'>"); |
| |
128 | html("<td class='lognotes-label'>Notes:</td>"); |
| |
129 | htmlf("<td colspan='%d' class='lognotes'>", |
| |
130 | cols); |
| |
131 | html_txt(notes.buf); |
| |
132 | html("</td></tr>\n"); |
| |
133 | } |
| |
134 | strbuf_release(¬es); |
123 | } |
135 | } |
124 | cgit_free_commitinfo(info); |
136 | cgit_free_commitinfo(info); |
125 | } |
137 | } |
126 | |
138 | |
127 | static const char *disambiguate_ref(const char *ref) |
139 | static const char *disambiguate_ref(const char *ref) |
128 | { |
140 | { |
129 | unsigned char sha1[20]; |
141 | unsigned char sha1[20]; |
130 | const char *longref; |
142 | const char *longref; |
131 | |
143 | |
132 | longref = fmt("refs/heads/%s", ref); |
144 | longref = fmt("refs/heads/%s", ref); |
133 | if (get_sha1(longref, sha1) == 0) |
145 | if (get_sha1(longref, sha1) == 0) |
134 | return longref; |
146 | return longref; |
135 | |
147 | |
136 | return ref; |
148 | return ref; |
137 | } |
149 | } |
138 | |
150 | |
139 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, |
151 | void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern, |
140 | char *path, int pager) |
152 | char *path, int pager) |
141 | { |
153 | { |
142 | struct rev_info rev; |
154 | struct rev_info rev; |
143 | struct commit *commit; |
155 | struct commit *commit; |
144 | const char *argv[] = {NULL, NULL, NULL, NULL, NULL}; |
156 | const char *argv[] = {NULL, NULL, NULL, NULL, NULL}; |
145 | int argc = 2; |
157 | int argc = 2; |
146 | int i, columns = 3; |
158 | int i, columns = 3; |
147 | |
159 | |
148 | if (!tip) |
160 | if (!tip) |
149 | tip = ctx.qry.head; |
161 | tip = ctx.qry.head; |
150 | |
162 | |
151 | argv[1] = disambiguate_ref(tip); |
163 | argv[1] = disambiguate_ref(tip); |
152 | |
164 | |
153 | if (grep && pattern) { |
165 | if (grep && pattern) { |
154 | if (!strcmp(grep, "grep") || !strcmp(grep, "author") || |
166 | if (!strcmp(grep, "grep") || !strcmp(grep, "author") || |
|