+ path = fmt("%s/%s", r2->path, ctx.cfg.agefile);
+ if (stat(path, &s) == 0) {
+ t2 = read_agefile(path);
+ } else {
+ path = fmt("%s/refs/heads/%s", r2->path, r2->defbranch);
+ if (stat(path, &s) != 0)
+ return 0;
+ t2 =s.st_mtime;
+ }
+ return t2-t1;
+}
+
+void cgit_print_repolist()
+{
+ int i, columns = 4, hits = 0, header = 0;
+ char *last_group = NULL;
+
+ if (ctx.cfg.enable_index_links)
+ columns++;
+
+ ctx.page.title = ctx.cfg.root_title;
+ cgit_print_http_headers(&ctx);
+ cgit_print_docstart(&ctx);
+ cgit_print_pageheader(&ctx);
+
+ if (ctx.cfg.index_header)
+ html_include(ctx.cfg.index_header);
+
+ if(ctx.qry.sort)
+ qsort(cgit_repolist.repos,cgit_repolist.count,sizeof(struct cgit_repo),cgit_reposort_modtime);
+
+ html("<table summary='repository list' class='list nowrap'>");