aboutsummaryrefslogtreecommitdiffstats
path: root/ui-repolist.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-repolist.c')
-rw-r--r--ui-repolist.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ui-repolist.c b/ui-repolist.c
index 25c36ce..d946f32 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -45,7 +45,8 @@ static int get_repo_modtime(const struct cgit_repo *repo, time_t *mtime)
45 return 1; 45 return 1;
46 } 46 }
47 47
48 path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch); 48 path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch ?
49 repo->defbranch : "master");
49 if (stat(path, &s) == 0) { 50 if (stat(path, &s) == 0) {
50 *mtime = s.st_mtime; 51 *mtime = s.st_mtime;
51 r->mtime = *mtime; 52 r->mtime = *mtime;
@@ -118,13 +119,13 @@ void print_header(int columns)
118} 119}
119 120
120 121
121void print_pager(int items, int pagelen, char *search) 122void print_pager(int items, int pagelen, char *search, char *sort)
122{ 123{
123 int i; 124 int i;
124 html("<div class='pager'>"); 125 html("<div class='pager'>");
125 for(i = 0; i * pagelen < items; i++) 126 for(i = 0; i * pagelen < items; i++)
126 cgit_index_link(fmt("[%d]", i+1), fmt("Page %d", i+1), NULL, 127 cgit_index_link(fmt("[%d]", i+1), fmt("Page %d", i+1), NULL,
127 search, i * pagelen); 128 search, sort, i * pagelen);
128 html("</div>"); 129 html("</div>");
129} 130}
130 131
@@ -291,7 +292,7 @@ void cgit_print_repolist()
291 if (!hits) 292 if (!hits)
292 cgit_print_error("No repositories found"); 293 cgit_print_error("No repositories found");
293 else if (hits > ctx.cfg.max_repo_count) 294 else if (hits > ctx.cfg.max_repo_count)
294 print_pager(hits, ctx.cfg.max_repo_count, ctx.qry.search); 295 print_pager(hits, ctx.cfg.max_repo_count, ctx.qry.search, ctx.qry.sort);
295 cgit_print_docend(); 296 cgit_print_docend();
296} 297}
297 298