diff options
author | Richard Maw <richard.maw@gmail.com> | 2016-06-30 23:06:46 +0300 |
---|---|---|
committer | Richard Maw <richard.maw@gmail.com> | 2016-07-13 22:09:37 +0300 |
commit | aa69de50d3c0ef30a2f97e95f0582445890d027b (patch) | |
tree | 5186b423fac6aa49cda890f148ce9d1992841abb | |
parent | bb2391a96b2b120ba82d797fcfb4b21e045ace06 (diff) |
Allow agefile to be set per-repository
This adds "repo.agefile", since namespaced repositories share the same files,
and we'd like to be able to see the ages of the refs for each namespace.
Whatever the git server uses for updating the age file must be namespace aware
and must write the age file to a path consistent with "repo.agefile".
Signed-off-by: Richard Maw <richard.maw@gmail.com>
-rw-r--r-- | cgit.c | 2 | ||||
-rw-r--r-- | cgit.h | 1 | ||||
-rw-r--r-- | ui-repolist.c | 3 |
3 files changed, 5 insertions, 1 deletions
@@ -88,6 +88,8 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va repo->logo = xstrdup(value); else if (!strcmp(name, "logo-link") && value != NULL) repo->logo_link = xstrdup(value); + else if (!strcmp(name, "agefile") && value != NULL) + repo->agefile = xstrdup(value); else if (!strcmp(name, "hide")) repo->hide = atoi(value); else if (!strcmp(name, "ignore")) @@ -88,6 +88,7 @@ struct cgit_repo { char *section; char *clone_url; char *namespace; + char *agefile; char *logo; char *logo_link; int snapshots; diff --git a/ui-repolist.c b/ui-repolist.c index 30915df..6b1afb6 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -42,7 +42,8 @@ static int get_repo_modtime(const struct cgit_repo *repo, time_t *mtime) *mtime = repo->mtime; return 1; } - strbuf_addf(&path, "%s/%s", repo->path, ctx.cfg.agefile); + strbuf_addf(&path, "%s/%s", repo->path, + repo->agefile ? repo->agefile : ctx.cfg.agefile); if (stat(path.buf, &s) == 0) { *mtime = read_agefile(path.buf); if (*mtime) { |