X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/e16f1783346a090e4ea1194dcaae7f03e813f6a2..f8f6e1fe789e9dbcea40a0f8d5ebfb019c2a1a19:/ui-repolist.c diff --git a/ui-repolist.c b/ui-repolist.c index 7c7aa9b..dce2eac 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -6,12 +6,6 @@ * (see COPYING for full license text) */ -/* This is needed for strcasestr to be defined by */ -#define _GNU_SOURCE 1 -#include - -#include - #include "cgit.h" #include "html.h" #include "ui-shared.h" @@ -26,7 +20,7 @@ time_t read_agefile(char *path) if (readfile(path, &buf, &size)) return -1; - if (parse_date(buf, buf2, sizeof(buf2))) + if (parse_date(buf, buf2, sizeof(buf2)) > 0) result = strtoul(buf2, NULL, 10); else result = 0; @@ -52,11 +46,20 @@ static int get_repo_modtime(const struct cgit_repo *repo, time_t *mtime) } path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch); - if (stat(path, &s) == 0) + if (stat(path, &s) == 0) { *mtime = s.st_mtime; - else - *mtime = 0; + r->mtime = *mtime; + return 1; + } + path = fmt("%s/%s", repo->path, "packed-refs"); + if (stat(path, &s) == 0) { + *mtime = s.st_mtime; + r->mtime = *mtime; + return 1; + } + + *mtime = 0; r->mtime = *mtime; return (r->mtime != 0); } @@ -94,7 +97,7 @@ int is_in_url(struct cgit_repo *repo) void print_sort_header(const char *title, const char *sort) { - htmlf(""); for (i=0; isection; + if (section && !strcmp(section, "")) + section = NULL; if (!sorted && - ((last_group == NULL && ctx.repo->group != NULL) || - (last_group != NULL && ctx.repo->group == NULL) || - (last_group != NULL && ctx.repo->group != NULL && - strcmp(ctx.repo->group, last_group)))) { - htmlf("", + ((last_section == NULL && section != NULL) || + (last_section != NULL && section == NULL) || + (last_section != NULL && section != NULL && + strcmp(section, last_section)))) { + htmlf("", columns); - html_txt(ctx.repo->group); + html_txt(section); html(""); - last_group = ctx.repo->group; + last_section = section; } htmlf("", - !sorted && ctx.repo->group ? "sublevel-repo" : "toplevel-repo"); + !sorted && section ? "sublevel-repo" : "toplevel-repo"); cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); html(""); html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL); @@ -278,7 +300,7 @@ void cgit_print_site_readme() if (!ctx.cfg.root_readme) return; if (ctx.cfg.about_filter) - cgit_open_filter(ctx.cfg.about_filter); + cgit_open_filter(ctx.cfg.about_filter, NULL); html_include(ctx.cfg.root_readme); if (ctx.cfg.about_filter) cgit_close_filter(ctx.cfg.about_filter);