about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ui-repolist.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/ui-repolist.c b/ui-repolist.c
index b57ea60..20a4f56 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -184,27 +184,6 @@ static int cmp(const char *s1, const char *s2)
 	return 0;
 }
 
-static int sort_section(const void *a, const void *b)
-{
-	const struct cgit_repo *r1 = a;
-	const struct cgit_repo *r2 = b;
-	int result;
-	time_t t;
-
-	result = cmp(r1->section, r2->section);
-	if (!result) {
-		if (!strcmp(ctx.cfg.repository_sort, "age")) {
-			// get_repo_modtime caches the value in r->mtime, so we don't
-			// have to worry about inefficiencies here.
-			if (get_repo_modtime(r1, &t) && get_repo_modtime(r2, &t))
-				result = r2->mtime - r1->mtime;
-		}
-		if (!result)
-			result = cmp(r1->name, r2->name);
-	}
-	return result;
-}
-
 static int sort_name(const void *a, const void *b)
 {
 	const struct cgit_repo *r1 = a;
@@ -241,6 +220,23 @@ static int sort_idle(const void *a, const void *b)
 	return t2 - t1;
 }
 
+static int sort_section(const void *a, const void *b)
+{
+	const struct cgit_repo *r1 = a;
+	const struct cgit_repo *r2 = b;
+	int result;
+	time_t t;
+
+	result = cmp(r1->section, r2->section);
+	if (!result) {
+		if (!strcmp(ctx.cfg.repository_sort, "age"))
+			result = sort_idle(r1, r2);
+		if (!result)
+			result = cmp(r1->name, r2->name);
+	}
+	return result;
+}
+
 struct sortcolumn {
 	const char *name;
 	int (*fn)(const void *a, const void *b);
11e8ff96b8898c48&follow=1'>main: Only set savestatus in exitcmdHerbert Xu 2018-05-28exec: Return 126 on most errors in shellexecHerbert Xu 2018-05-17Release 0.5.10.2.Herbert Xu 2018-05-15parser: Fix incorrect eating of backslash newlinesHerbert Xu 2018-05-10Release 0.5.10.1.Herbert Xu 2018-05-09jobs - Do not block when waiting on SIGCHLDHerbert Xu 2018-05-03Release 0.5.10.Herbert Xu 2018-04-19eval: Variable assignments on functions are no longer persistentHerbert Xu 2018-04-19parser: Fix parameter expansion inside inner double quotesHerbert Xu 2018-04-19parser: Fix parsing of ${}Herbert Xu 2018-04-19man: correct typos, iff -> ifMartijn Dekker 2018-04-19expand: Do not quote backslashes in unquoted parameter expansionHerbert Xu 2018-04-19shell: Add subdir-objects to AM_INIT_AUTOMAKEJason Bowen 2018-04-19eval: Restore input files in evalcommandHerbert Xu 2018-04-19eval: Reap zombies after built-in commands and functionsHerbert Xu 2018-04-19redir: Fix typo in noclobber codeHerbert Xu 2018-04-19expand: Fix glibc glob(3) supportHerbert Xu 2018-04-02expand: Fix buffer overflow in expandmetaHerbert Xu 2018-04-02builtin: Move echo space/nl handling into print_escape_strHerbert Xu 2018-04-02builtin: Fix echo performance regressionHerbert Xu 2018-04-02expand: Fix ghost fields with unquoted $@/$*Herbert Xu 2018-04-02parser: Allow newlines within parameter substitutionHerbert Xu 2018-04-02expand: Fix bugs with words connected to the right of $@Herbert Xu 2018-03-25Revert "[BUILTIN] Remove unnecessary restoration of format string in printf"Herbert Xu 2018-03-22parser: Fix backquote support in here-document EOF markHerbert Xu