|
diff --git a/ui-log.c b/ui-log.c index d212984..3202848 100644 --- a/ ui-log.c+++ b/ ui-log.c |
|
@@ -31,21 +31,57 @@ void inspect_files(struct diff_filepair *pair) |
31 | cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines); |
31 | cgit_diff_files(pair->one->sha1, pair->two->sha1, count_lines); |
32 | } |
32 | } |
33 | |
33 | |
| |
34 | void show_commit_decorations(struct commit *commit) |
| |
35 | { |
| |
36 | struct name_decoration *deco; |
| |
37 | static char buf[1024]; |
| |
38 | |
| |
39 | buf[sizeof(buf) - 1] = 0; |
| |
40 | deco = lookup_decoration(&name_decoration, &commit->object); |
| |
41 | while (deco) { |
| |
42 | if (!prefixcmp(deco->name, "refs/heads/")) { |
| |
43 | strncpy(buf, deco->name + 11, sizeof(buf) - 1); |
| |
44 | cgit_log_link(buf, NULL, "branch-deco", buf, NULL, NULL, |
| |
45 | 0, NULL, NULL, ctx.qry.showmsg); |
| |
46 | } |
| |
47 | else if (!prefixcmp(deco->name, "tag: refs/tags/")) { |
| |
48 | strncpy(buf, deco->name + 15, sizeof(buf) - 1); |
| |
49 | cgit_tag_link(buf, NULL, "tag-deco", ctx.qry.head, buf); |
| |
50 | } |
| |
51 | else if (!prefixcmp(deco->name, "refs/remotes/")) { |
| |
52 | strncpy(buf, deco->name + 13, sizeof(buf) - 1); |
| |
53 | cgit_log_link(buf, NULL, "remote-deco", NULL, |
| |
54 | sha1_to_hex(commit->object.sha1), NULL, |
| |
55 | 0, NULL, NULL, ctx.qry.showmsg); |
| |
56 | } |
| |
57 | else { |
| |
58 | strncpy(buf, deco->name, sizeof(buf) - 1); |
| |
59 | cgit_commit_link(buf, NULL, "deco", ctx.qry.head, |
| |
60 | sha1_to_hex(commit->object.sha1)); |
| |
61 | } |
| |
62 | deco = deco->next; |
| |
63 | } |
| |
64 | } |
| |
65 | |
34 | void print_commit(struct commit *commit) |
66 | void print_commit(struct commit *commit) |
35 | { |
67 | { |
36 | struct commitinfo *info; |
68 | struct commitinfo *info; |
37 | char *tmp; |
69 | char *tmp; |
| |
70 | int cols = 2; |
38 | |
71 | |
39 | info = cgit_parse_commit(commit); |
72 | info = cgit_parse_commit(commit); |
40 | html("<tr><td>"); |
73 | htmlf("<tr%s><td>", |
| |
74 | ctx.qry.showmsg ? " class='logheader'" : ""); |
41 | tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1)); |
75 | tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1)); |
42 | tmp = cgit_pageurl(ctx.repo->url, "commit", tmp); |
76 | tmp = cgit_pageurl(ctx.repo->url, "commit", tmp); |
43 | html_link_open(tmp, NULL, NULL); |
77 | html_link_open(tmp, NULL, NULL); |
44 | cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); |
78 | cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); |
45 | html_link_close(); |
79 | html_link_close(); |
46 | html("</td><td>"); |
80 | htmlf("</td><td%s>", |
| |
81 | ctx.qry.showmsg ? " class='logsubject'" : ""); |
47 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, |
82 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, |
48 | sha1_to_hex(commit->object.sha1)); |
83 | sha1_to_hex(commit->object.sha1)); |
| |
84 | show_commit_decorations(commit); |
49 | html("</td><td>"); |
85 | html("</td><td>"); |
50 | html_txt(info->author); |
86 | html_txt(info->author); |
51 | if (ctx.repo->enable_log_filecount) { |
87 | if (ctx.repo->enable_log_filecount) { |
@@ -61,6 +97,17 @@ void print_commit(struct commit *commit) |
61 | } |
97 | } |
62 | } |
98 | } |
63 | html("</td></tr>\n"); |
99 | html("</td></tr>\n"); |
| |
100 | if (ctx.qry.showmsg) { |
| |
101 | if (ctx.repo->enable_log_filecount) { |
| |
102 | cols++; |
| |
103 | if (ctx.repo->enable_log_linecount) |
| |
104 | cols++; |
| |
105 | } |
| |
106 | htmlf("<tr class='nohover'><td/><td colspan='%d' class='logmsg'>", |
| |
107 | cols); |
| |
108 | html_txt(info->msg); |
| |
109 | html("</td></tr>\n"); |
| |
110 | } |
64 | cgit_free_commitinfo(info); |
111 | cgit_free_commitinfo(info); |
65 | } |
112 | } |
66 | |
113 | |
@@ -105,6 +152,8 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern |
105 | rev.verbose_header = 1; |
152 | rev.verbose_header = 1; |
106 | rev.show_root_diff = 0; |
153 | rev.show_root_diff = 0; |
107 | setup_revisions(argc, argv, &rev, NULL); |
154 | setup_revisions(argc, argv, &rev, NULL); |
| |
155 | load_ref_decorations(); |
| |
156 | rev.show_decorations = 1; |
108 | rev.grep_filter.regflags |= REG_ICASE; |
157 | rev.grep_filter.regflags |= REG_ICASE; |
109 | compile_grep_patterns(&rev.grep_filter); |
158 | compile_grep_patterns(&rev.grep_filter); |
110 | prepare_revision_walk(&rev); |
159 | prepare_revision_walk(&rev); |
@@ -113,8 +162,16 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern |
113 | html("<table class='list nowrap'>"); |
162 | html("<table class='list nowrap'>"); |
114 | |
163 | |
115 | html("<tr class='nohover'><th class='left'>Age</th>" |
164 | html("<tr class='nohover'><th class='left'>Age</th>" |
116 | "<th class='left'>Commit message</th>" |
165 | "<th class='left'>Commit message"); |
117 | "<th class='left'>Author</th>"); |
166 | if (pager) { |
| |
167 | html(" ("); |
| |
168 | cgit_log_link(ctx.qry.showmsg ? "Collapse" : "Expand", NULL, |
| |
169 | NULL, ctx.qry.head, ctx.qry.sha1, |
| |
170 | ctx.qry.path, ctx.qry.ofs, ctx.qry.grep, |
| |
171 | ctx.qry.search, ctx.qry.showmsg ? 0 : 1); |
| |
172 | html(")"); |
| |
173 | } |
| |
174 | html("</th><th class='left'>Author</th>"); |
118 | if (ctx.repo->enable_log_filecount) { |
175 | if (ctx.repo->enable_log_filecount) { |
119 | html("<th class='left'>Files</th>"); |
176 | html("<th class='left'>Files</th>"); |
120 | columns++; |
177 | columns++; |
@@ -149,20 +206,20 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern |
149 | cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, |
206 | cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, |
150 | ctx.qry.sha1, ctx.qry.path, |
207 | ctx.qry.sha1, ctx.qry.path, |
151 | ofs - cnt, ctx.qry.grep, |
208 | ofs - cnt, ctx.qry.grep, |
152 | ctx.qry.search); |
209 | ctx.qry.search, ctx.qry.showmsg); |
153 | html(" "); |
210 | html(" "); |
154 | } |
211 | } |
155 | if ((commit = get_revision(&rev)) != NULL) { |
212 | if ((commit = get_revision(&rev)) != NULL) { |
156 | cgit_log_link("[next]", NULL, NULL, ctx.qry.head, |
213 | cgit_log_link("[next]", NULL, NULL, ctx.qry.head, |
157 | ctx.qry.sha1, ctx.qry.path, |
214 | ctx.qry.sha1, ctx.qry.path, |
158 | ofs + cnt, ctx.qry.grep, |
215 | ofs + cnt, ctx.qry.grep, |
159 | ctx.qry.search); |
216 | ctx.qry.search, ctx.qry.showmsg); |
160 | } |
217 | } |
161 | html("</div>"); |
218 | html("</div>"); |
162 | } else if ((commit = get_revision(&rev)) != NULL) { |
219 | } else if ((commit = get_revision(&rev)) != NULL) { |
163 | html("<tr class='nohover'><td colspan='3'>"); |
220 | html("<tr class='nohover'><td colspan='3'>"); |
164 | cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0, |
221 | cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0, |
165 | NULL, NULL); |
222 | NULL, NULL, ctx.qry.showmsg); |
166 | html("</td></tr>\n"); |
223 | html("</td></tr>\n"); |
167 | } |
224 | } |
168 | } |
225 | } |
|