|
diff --git a/ui-refs.c b/ui-refs.c index d3b4f6e..98738db 100644 --- a/ ui-refs.c+++ b/ ui-refs.c |
|
@@ -53,49 +53,49 @@ static int cmp_tag_age(const void *a, const void *b) |
53 | else |
53 | else |
54 | r1date = r1->commit->committer_date; |
54 | r1date = r1->commit->committer_date; |
55 | |
55 | |
56 | if (r2->object->type != OBJ_COMMIT) |
56 | if (r2->object->type != OBJ_COMMIT) |
57 | r2date = r2->tag->tagger_date; |
57 | r2date = r2->tag->tagger_date; |
58 | else |
58 | else |
59 | r2date = r2->commit->committer_date; |
59 | r2date = r2->commit->committer_date; |
60 | |
60 | |
61 | return cmp_age(r1date, r2date); |
61 | return cmp_age(r1date, r2date); |
62 | } |
62 | } |
63 | |
63 | |
64 | static int print_branch(struct refinfo *ref) |
64 | static int print_branch(struct refinfo *ref) |
65 | { |
65 | { |
66 | struct commitinfo *info = ref->commit; |
66 | struct commitinfo *info = ref->commit; |
67 | char *name = (char *)ref->refname; |
67 | char *name = (char *)ref->refname; |
68 | |
68 | |
69 | if (!info) |
69 | if (!info) |
70 | return 1; |
70 | return 1; |
71 | html("<tr><td>"); |
71 | html("<tr><td>"); |
72 | cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL, |
72 | cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL, |
73 | ctx.qry.showmsg); |
73 | ctx.qry.showmsg); |
74 | html("</td><td>"); |
74 | html("</td><td>"); |
75 | |
75 | |
76 | if (ref->object->type == OBJ_COMMIT) { |
76 | if (ref->object->type == OBJ_COMMIT) { |
77 | cgit_commit_link(info->subject, NULL, NULL, name, NULL); |
77 | cgit_commit_link(info->subject, NULL, NULL, name, NULL, 0); |
78 | html("</td><td>"); |
78 | html("</td><td>"); |
79 | html_txt(info->author); |
79 | html_txt(info->author); |
80 | html("</td><td colspan='2'>"); |
80 | html("</td><td colspan='2'>"); |
81 | cgit_print_age(info->commit->date, -1, NULL); |
81 | cgit_print_age(info->commit->date, -1, NULL); |
82 | } else { |
82 | } else { |
83 | html("</td><td></td><td>"); |
83 | html("</td><td></td><td>"); |
84 | cgit_object_link(ref->object); |
84 | cgit_object_link(ref->object); |
85 | } |
85 | } |
86 | html("</td></tr>\n"); |
86 | html("</td></tr>\n"); |
87 | return 0; |
87 | return 0; |
88 | } |
88 | } |
89 | |
89 | |
90 | static void print_tag_header() |
90 | static void print_tag_header() |
91 | { |
91 | { |
92 | html("<tr class='nohover'><th class='left'>Tag</th>" |
92 | html("<tr class='nohover'><th class='left'>Tag</th>" |
93 | "<th class='left'>Download</th>" |
93 | "<th class='left'>Download</th>" |
94 | "<th class='left'>Author</th>" |
94 | "<th class='left'>Author</th>" |
95 | "<th class='left' colspan='2'>Age</th></tr>\n"); |
95 | "<th class='left' colspan='2'>Age</th></tr>\n"); |
96 | header = 1; |
96 | header = 1; |
97 | } |
97 | } |
98 | |
98 | |
99 | static void print_tag_downloads(const struct cgit_repo *repo, const char *ref) |
99 | static void print_tag_downloads(const struct cgit_repo *repo, const char *ref) |
100 | { |
100 | { |
101 | const struct cgit_snapshot_format* f; |
101 | const struct cgit_snapshot_format* f; |
@@ -166,48 +166,50 @@ static int print_tag(struct refinfo *ref) |
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; |
|