|
diff --git a/ui-log.c b/ui-log.c index d212984..2f90778 100644 --- a/ ui-log.c+++ b/ ui-log.c |
|
@@ -26,50 +26,64 @@ void count_lines(char *line, int size) |
26 | |
26 | |
27 | void inspect_files(struct diff_filepair *pair) |
27 | void inspect_files(struct diff_filepair *pair) |
28 | { |
28 | { |
29 | files++; |
29 | files++; |
30 | if (ctx.repo->enable_log_linecount) |
30 | if (ctx.repo->enable_log_linecount) |
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 print_commit(struct commit *commit) |
34 | void print_commit(struct commit *commit) |
35 | { |
35 | { |
36 | struct commitinfo *info; |
36 | struct commitinfo *info; |
37 | char *tmp; |
37 | char *tmp; |
| |
38 | int cols = 2; |
38 | |
39 | |
39 | info = cgit_parse_commit(commit); |
40 | info = cgit_parse_commit(commit); |
40 | html("<tr><td>"); |
41 | htmlf("<tr%s><td>", |
| |
42 | ctx.qry.showmsg ? " class='logheader'" : ""); |
41 | tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1)); |
43 | tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1)); |
42 | tmp = cgit_pageurl(ctx.repo->url, "commit", tmp); |
44 | tmp = cgit_pageurl(ctx.repo->url, "commit", tmp); |
43 | html_link_open(tmp, NULL, NULL); |
45 | html_link_open(tmp, NULL, NULL); |
44 | cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); |
46 | cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); |
45 | html_link_close(); |
47 | html_link_close(); |
46 | html("</td><td>"); |
48 | htmlf("</td><td%s>", |
| |
49 | ctx.qry.showmsg ? " class='logsubject'" : ""); |
47 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, |
50 | cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, |
48 | sha1_to_hex(commit->object.sha1)); |
51 | sha1_to_hex(commit->object.sha1)); |
49 | html("</td><td>"); |
52 | html("</td><td>"); |
50 | html_txt(info->author); |
53 | html_txt(info->author); |
51 | if (ctx.repo->enable_log_filecount) { |
54 | if (ctx.repo->enable_log_filecount) { |
52 | files = 0; |
55 | files = 0; |
53 | add_lines = 0; |
56 | add_lines = 0; |
54 | rem_lines = 0; |
57 | rem_lines = 0; |
55 | cgit_diff_commit(commit, inspect_files); |
58 | cgit_diff_commit(commit, inspect_files); |
56 | html("</td><td>"); |
59 | html("</td><td>"); |
57 | htmlf("%d", files); |
60 | htmlf("%d", files); |
58 | if (ctx.repo->enable_log_linecount) { |
61 | if (ctx.repo->enable_log_linecount) { |
59 | html("</td><td>"); |
62 | html("</td><td>"); |
60 | htmlf("-%d/+%d", rem_lines, add_lines); |
63 | htmlf("-%d/+%d", rem_lines, add_lines); |
61 | } |
64 | } |
62 | } |
65 | } |
63 | html("</td></tr>\n"); |
66 | html("</td></tr>\n"); |
| |
67 | if (ctx.qry.showmsg) { |
| |
68 | if (ctx.repo->enable_log_filecount) { |
| |
69 | cols++; |
| |
70 | if (ctx.repo->enable_log_linecount) |
| |
71 | cols++; |
| |
72 | } |
| |
73 | htmlf("<tr class='nohover'><td/><td colspan='%d' class='logmsg'>", |
| |
74 | cols); |
| |
75 | html_txt(info->msg); |
| |
76 | html("</td></tr>\n"); |
| |
77 | } |
64 | cgit_free_commitinfo(info); |
78 | cgit_free_commitinfo(info); |
65 | } |
79 | } |
66 | |
80 | |
67 | static const char *disambiguate_ref(const char *ref) |
81 | static const char *disambiguate_ref(const char *ref) |
68 | { |
82 | { |
69 | unsigned char sha1[20]; |
83 | unsigned char sha1[20]; |
70 | const char *longref; |
84 | const char *longref; |
71 | |
85 | |
72 | longref = fmt("refs/heads/%s", ref); |
86 | longref = fmt("refs/heads/%s", ref); |
73 | if (get_sha1(longref, sha1) == 0) |
87 | if (get_sha1(longref, sha1) == 0) |
74 | return longref; |
88 | return longref; |
75 | |
89 | |
@@ -104,26 +118,33 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern |
104 | rev.commit_format = CMIT_FMT_DEFAULT; |
118 | rev.commit_format = CMIT_FMT_DEFAULT; |
105 | rev.verbose_header = 1; |
119 | rev.verbose_header = 1; |
106 | rev.show_root_diff = 0; |
120 | rev.show_root_diff = 0; |
107 | setup_revisions(argc, argv, &rev, NULL); |
121 | setup_revisions(argc, argv, &rev, NULL); |
108 | rev.grep_filter.regflags |= REG_ICASE; |
122 | rev.grep_filter.regflags |= REG_ICASE; |
109 | compile_grep_patterns(&rev.grep_filter); |
123 | compile_grep_patterns(&rev.grep_filter); |
110 | prepare_revision_walk(&rev); |
124 | prepare_revision_walk(&rev); |
111 | |
125 | |
112 | if (pager) |
126 | if (pager) |
113 | html("<table class='list nowrap'>"); |
127 | html("<table class='list nowrap'>"); |
114 | |
128 | |
115 | html("<tr class='nohover'><th class='left'>Age</th>" |
129 | html("<tr class='nohover'><th class='left'>Age</th>" |
116 | "<th class='left'>Commit message</th>" |
130 | "<th class='left'>Commit message"); |
117 | "<th class='left'>Author</th>"); |
131 | if (pager) { |
| |
132 | html(" ("); |
| |
133 | cgit_log_link("toggle", NULL, NULL, ctx.qry.head, ctx.qry.sha1, |
| |
134 | ctx.qry.path, ctx.qry.ofs, ctx.qry.grep, |
| |
135 | ctx.qry.search, ctx.qry.showmsg ? 0 : 1); |
| |
136 | html(")"); |
| |
137 | } |
| |
138 | html("</th><th class='left'>Author</th>"); |
118 | if (ctx.repo->enable_log_filecount) { |
139 | if (ctx.repo->enable_log_filecount) { |
119 | html("<th class='left'>Files</th>"); |
140 | html("<th class='left'>Files</th>"); |
120 | columns++; |
141 | columns++; |
121 | if (ctx.repo->enable_log_linecount) { |
142 | if (ctx.repo->enable_log_linecount) { |
122 | html("<th class='left'>Lines</th>"); |
143 | html("<th class='left'>Lines</th>"); |
123 | columns++; |
144 | columns++; |
124 | } |
145 | } |
125 | } |
146 | } |
126 | html("</tr>\n"); |
147 | html("</tr>\n"); |
127 | |
148 | |
128 | if (ofs<0) |
149 | if (ofs<0) |
129 | ofs = 0; |
150 | ofs = 0; |
@@ -140,29 +161,29 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern |
140 | free(commit->buffer); |
161 | free(commit->buffer); |
141 | commit->buffer = NULL; |
162 | commit->buffer = NULL; |
142 | free_commit_list(commit->parents); |
163 | free_commit_list(commit->parents); |
143 | commit->parents = NULL; |
164 | commit->parents = NULL; |
144 | } |
165 | } |
145 | if (pager) { |
166 | if (pager) { |
146 | htmlf("</table><div class='pager'>", |
167 | htmlf("</table><div class='pager'>", |
147 | columns); |
168 | columns); |
148 | if (ofs > 0) { |
169 | if (ofs > 0) { |
149 | cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, |
170 | cgit_log_link("[prev]", NULL, NULL, ctx.qry.head, |
150 | ctx.qry.sha1, ctx.qry.path, |
171 | ctx.qry.sha1, ctx.qry.path, |
151 | ofs - cnt, ctx.qry.grep, |
172 | ofs - cnt, ctx.qry.grep, |
152 | ctx.qry.search); |
173 | ctx.qry.search, ctx.qry.showmsg); |
153 | html(" "); |
174 | html(" "); |
154 | } |
175 | } |
155 | if ((commit = get_revision(&rev)) != NULL) { |
176 | if ((commit = get_revision(&rev)) != NULL) { |
156 | cgit_log_link("[next]", NULL, NULL, ctx.qry.head, |
177 | cgit_log_link("[next]", NULL, NULL, ctx.qry.head, |
157 | ctx.qry.sha1, ctx.qry.path, |
178 | ctx.qry.sha1, ctx.qry.path, |
158 | ofs + cnt, ctx.qry.grep, |
179 | ofs + cnt, ctx.qry.grep, |
159 | ctx.qry.search); |
180 | ctx.qry.search, ctx.qry.showmsg); |
160 | } |
181 | } |
161 | html("</div>"); |
182 | html("</div>"); |
162 | } else if ((commit = get_revision(&rev)) != NULL) { |
183 | } else if ((commit = get_revision(&rev)) != NULL) { |
163 | html("<tr class='nohover'><td colspan='3'>"); |
184 | html("<tr class='nohover'><td colspan='3'>"); |
164 | cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0, |
185 | cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0, |
165 | NULL, NULL); |
186 | NULL, NULL, ctx.qry.showmsg); |
166 | html("</td></tr>\n"); |
187 | html("</td></tr>\n"); |
167 | } |
188 | } |
168 | } |
189 | } |
|