|
diff --git a/ui-refs.c b/ui-refs.c index d3b4f6e..b3489ee 100644 --- a/ ui-refs.c+++ b/ ui-refs.c |
|
@@ -142,96 +142,98 @@ static int print_tag(struct refinfo *ref) |
142 | html("</td><td>"); |
142 | html("</td><td>"); |
143 | if (info->tagger) |
143 | if (info->tagger) |
144 | html(info->tagger); |
144 | html(info->tagger); |
145 | html("</td><td colspan='2'>"); |
145 | html("</td><td colspan='2'>"); |
146 | if (info->tagger_date > 0) |
146 | if (info->tagger_date > 0) |
147 | cgit_print_age(info->tagger_date, -1, NULL); |
147 | cgit_print_age(info->tagger_date, -1, NULL); |
148 | html("</td></tr>\n"); |
148 | html("</td></tr>\n"); |
149 | } else { |
149 | } else { |
150 | if (!header) |
150 | if (!header) |
151 | print_tag_header(); |
151 | print_tag_header(); |
152 | html("<tr><td>"); |
152 | html("<tr><td>"); |
153 | cgit_tag_link(name, NULL, NULL, ctx.qry.head, name); |
153 | cgit_tag_link(name, NULL, NULL, ctx.qry.head, name); |
154 | html("</td><td>"); |
154 | html("</td><td>"); |
155 | if (ctx.repo->snapshots && (ref->object->type == OBJ_COMMIT)) |
155 | if (ctx.repo->snapshots && (ref->object->type == OBJ_COMMIT)) |
156 | print_tag_downloads(ctx.repo, name); |
156 | print_tag_downloads(ctx.repo, name); |
157 | else |
157 | else |
158 | cgit_object_link(ref->object); |
158 | cgit_object_link(ref->object); |
159 | html("</td><td>"); |
159 | html("</td><td>"); |
160 | if (ref->object->type == OBJ_COMMIT) |
160 | if (ref->object->type == OBJ_COMMIT) |
161 | html(ref->commit->author); |
161 | html(ref->commit->author); |
162 | html("</td><td colspan='2'>"); |
162 | html("</td><td colspan='2'>"); |
163 | if (ref->object->type == OBJ_COMMIT) |
163 | if (ref->object->type == OBJ_COMMIT) |
164 | cgit_print_age(ref->commit->commit->date, -1, NULL); |
164 | cgit_print_age(ref->commit->commit->date, -1, NULL); |
165 | html("</td></tr>\n"); |
165 | html("</td></tr>\n"); |
166 | } |
166 | } |
167 | return 0; |
167 | return 0; |
168 | } |
168 | } |
169 | |
169 | |
170 | static void print_refs_link(char *path) |
170 | static void print_refs_link(char *path) |
171 | { |
171 | { |
172 | html("<tr class='nohover'><td colspan='4'>"); |
172 | html("<tr class='nohover'><td colspan='4'>"); |
173 | cgit_refs_link("[...]", NULL, NULL, ctx.qry.head, NULL, path); |
173 | cgit_refs_link("[...]", NULL, NULL, ctx.qry.head, NULL, path); |
174 | html("</td></tr>"); |
174 | html("</td></tr>"); |
175 | } |
175 | } |
176 | |
176 | |
177 | void cgit_print_branches(int maxcount) |
177 | void cgit_print_branches(int maxcount) |
178 | { |
178 | { |
179 | struct reflist list; |
179 | struct reflist list; |
180 | int i; |
180 | int i; |
181 | |
181 | |
182 | html("<tr class='nohover'><th class='left'>Branch</th>" |
182 | html("<tr class='nohover'><th class='left'>Branch</th>" |
183 | "<th class='left'>Commit message</th>" |
183 | "<th class='left'>Commit message</th>" |
184 | "<th class='left'>Author</th>" |
184 | "<th class='left'>Author</th>" |
185 | "<th class='left' colspan='2'>Age</th></tr>\n"); |
185 | "<th class='left' colspan='2'>Age</th></tr>\n"); |
186 | |
186 | |
187 | list.refs = NULL; |
187 | list.refs = NULL; |
188 | list.alloc = list.count = 0; |
188 | list.alloc = list.count = 0; |
189 | for_each_branch_ref(cgit_refs_cb, &list); |
189 | for_each_branch_ref(cgit_refs_cb, &list); |
| |
190 | if (ctx.repo->enable_remote_branches) |
| |
191 | for_each_remote_ref(cgit_refs_cb, &list); |
190 | |
192 | |
191 | if (maxcount == 0 || maxcount > list.count) |
193 | if (maxcount == 0 || maxcount > list.count) |
192 | maxcount = list.count; |
194 | maxcount = list.count; |
193 | |
195 | |
194 | if (maxcount < list.count) { |
196 | if (maxcount < list.count) { |
195 | qsort(list.refs, list.count, sizeof(*list.refs), cmp_branch_age); |
197 | qsort(list.refs, list.count, sizeof(*list.refs), cmp_branch_age); |
196 | qsort(list.refs, maxcount, sizeof(*list.refs), cmp_ref_name); |
198 | qsort(list.refs, maxcount, sizeof(*list.refs), cmp_ref_name); |
197 | } |
199 | } |
198 | |
200 | |
199 | for(i=0; i<maxcount; i++) |
201 | for(i=0; i<maxcount; i++) |
200 | print_branch(list.refs[i]); |
202 | print_branch(list.refs[i]); |
201 | |
203 | |
202 | if (maxcount < list.count) |
204 | if (maxcount < list.count) |
203 | print_refs_link("heads"); |
205 | print_refs_link("heads"); |
204 | } |
206 | } |
205 | |
207 | |
206 | void cgit_print_tags(int maxcount) |
208 | void cgit_print_tags(int maxcount) |
207 | { |
209 | { |
208 | struct reflist list; |
210 | struct reflist list; |
209 | int i; |
211 | int i; |
210 | |
212 | |
211 | header = 0; |
213 | header = 0; |
212 | list.refs = NULL; |
214 | list.refs = NULL; |
213 | list.alloc = list.count = 0; |
215 | list.alloc = list.count = 0; |
214 | for_each_tag_ref(cgit_refs_cb, &list); |
216 | for_each_tag_ref(cgit_refs_cb, &list); |
215 | if (list.count == 0) |
217 | if (list.count == 0) |
216 | return; |
218 | return; |
217 | qsort(list.refs, list.count, sizeof(*list.refs), cmp_tag_age); |
219 | qsort(list.refs, list.count, sizeof(*list.refs), cmp_tag_age); |
218 | if (!maxcount) |
220 | if (!maxcount) |
219 | maxcount = list.count; |
221 | maxcount = list.count; |
220 | else if (maxcount > list.count) |
222 | else if (maxcount > list.count) |
221 | maxcount = list.count; |
223 | maxcount = list.count; |
222 | print_tag_header(); |
224 | print_tag_header(); |
223 | for(i=0; i<maxcount; i++) |
225 | for(i=0; i<maxcount; i++) |
224 | print_tag(list.refs[i]); |
226 | print_tag(list.refs[i]); |
225 | |
227 | |
226 | if (maxcount < list.count) |
228 | if (maxcount < list.count) |
227 | print_refs_link("tags"); |
229 | print_refs_link("tags"); |
228 | } |
230 | } |
229 | |
231 | |
230 | void cgit_print_refs() |
232 | void cgit_print_refs() |
231 | { |
233 | { |
232 | |
234 | |
233 | html("<table class='list nowrap'>"); |
235 | html("<table class='list nowrap'>"); |
234 | |
236 | |
235 | if (ctx.qry.path && !strncmp(ctx.qry.path, "heads", 5)) |
237 | if (ctx.qry.path && !strncmp(ctx.qry.path, "heads", 5)) |
236 | cgit_print_branches(0); |
238 | cgit_print_branches(0); |
237 | else if (ctx.qry.path && !strncmp(ctx.qry.path, "tags", 4)) |
239 | else if (ctx.qry.path && !strncmp(ctx.qry.path, "tags", 4)) |
|