about summary refs log tree commit diff
diff options
context:
space:
mode:
-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
@@ -10,6 +10,23 @@
 
 static int header;
 
+static int cmp_tag_age(void *a, void *b)
+{
+	struct refinfo *r1 = *(struct refinfo **)a;
+	struct refinfo *r2 = *(struct refinfo **)b;
+
+	if (r1->tag->tagger_date != 0 && r2->tag->tagger_date != 0)
+		return r2->tag->tagger_date - r1->tag->tagger_date;
+
+	if (r1->tag->tagger_date == 0 && r2->tag->tagger_date == 0)
+		return 0;
+
+	if (r1 == 0)
+		return +1;
+
+	return -1;
+}
+
 static void cgit_print_branch(struct refinfo *ref)
 {
 	struct commit *commit;
@@ -156,6 +173,7 @@ static void cgit_print_tags()
 	for_each_tag_ref(cgit_refs_cb, &list);
 	if (list.count == 0)
 		return;
+	qsort(list.refs, list.count, sizeof(*list.refs), cmp_tag_age);
 	print_tag_header();
 	for(i=0; i<list.count; i++)
 		print_tag(list.refs[i]);
15:31:59 -0500'>2015-11-06Add prune scriptJune McEnroe 2015-11-03Update vendored Gruvbox colorschemeJune McEnroe 2015-11-02Redefine _newline_precmd in _newline_precmdJune McEnroe 2015-11-02Print newline before every prompt after firstJune McEnroe 2015-11-02Remove first prompt placementJune McEnroe 2015-11-02Newline before prompt and start at bottom of terminalJune McEnroe 2015-10-27Add chruby to zshrcJune McEnroe1a8a234789d6a179&follow=1'>Day 6, part 2June McEnroe 2020-11-22Day 6June McEnroe 2020-11-22Day 5, part 2June McEnroe 2020-11-22Day 5June McEnroe 2020-11-22Day 4, part 2June McEnroe That ugly sort map though. 2020-11-22Day 4June McEnroe 2020-11-22Day 3, part 2June McEnroe I am super surprised that worked on the first try. 2020-11-22Day 3, clean upJune McEnroe 2020-11-22Day 3June McEnroe This is fucking awful and I'm angry. 2020-11-22Day 2, part 2June McEnroe 2020-11-22Day 2June McEnroe 2020-11-22Day 1, part 2June McEnroe 2020-11-22Day 1June McEnroe 2020-11-22Move to 2016 directoryJune McEnroe