summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ui-summary.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/ui-summary.c b/ui-summary.c
index c684628..43582da 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -7,12 +7,29 @@
7 */ 7 */
8 8
9#include "cgit.h" 9#include "cgit.h"
10 10
11static int header; 11static int header;
12 12
13static int cmp_tag_age(void *a, void *b)
14{
15 struct refinfo *r1 = *(struct refinfo **)a;
16 struct refinfo *r2 = *(struct refinfo **)b;
17
18 if (r1->tag->tagger_date != 0 && r2->tag->tagger_date != 0)
19 return r2->tag->tagger_date - r1->tag->tagger_date;
20
21 if (r1->tag->tagger_date == 0 && r2->tag->tagger_date == 0)
22 return 0;
23
24 if (r1 == 0)
25 return +1;
26
27 return -1;
28}
29
13static void cgit_print_branch(struct refinfo *ref) 30static void cgit_print_branch(struct refinfo *ref)
14{ 31{
15 struct commit *commit; 32 struct commit *commit;
16 struct commitinfo *info; 33 struct commitinfo *info;
17 char *name = (char *)ref->refname; 34 char *name = (char *)ref->refname;
18 35
@@ -153,12 +170,13 @@ static void cgit_print_tags()
153 header = 0; 170 header = 0;
154 list.refs = NULL; 171 list.refs = NULL;
155 list.alloc = list.count = 0; 172 list.alloc = list.count = 0;
156 for_each_tag_ref(cgit_refs_cb, &list); 173 for_each_tag_ref(cgit_refs_cb, &list);
157 if (list.count == 0) 174 if (list.count == 0)
158 return; 175 return;
176 qsort(list.refs, list.count, sizeof(*list.refs), cmp_tag_age);
159 print_tag_header(); 177 print_tag_header();
160 for(i=0; i<list.count; i++) 178 for(i=0; i<list.count; i++)
161 print_tag(list.refs[i]); 179 print_tag(list.refs[i]);
162} 180}
163 181
164static void cgit_print_archives() 182static void cgit_print_archives()