]> granicus.if.org Git - cgit/commitdiff
Allow agefile to be set per-repository
authorRichard Maw <richard.maw@gmail.com>
Thu, 30 Jun 2016 20:06:46 +0000 (21:06 +0100)
committerRichard Maw <richard.maw@gmail.com>
Wed, 13 Jul 2016 19:09:37 +0000 (20:09 +0100)
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>
cgit.c
cgit.h
ui-repolist.c

diff --git a/cgit.c b/cgit.c
index d4280191b0d5ed5f86766fab90da9b7c2b2d1620..a87f245fc3625c4122931526b43f417a8a1af7b6 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -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"))
diff --git a/cgit.h b/cgit.h
index f0d25d65a2d1942a211f63e7792f118aeb0fa41e..b6994a34bf5086f3dc67b0e7fd18270f05fa6301 100644 (file)
--- a/cgit.h
+++ b/cgit.h
@@ -88,6 +88,7 @@ struct cgit_repo {
        char *section;
        char *clone_url;
        char *namespace;
+       char *agefile;
        char *logo;
        char *logo_link;
        int snapshots;
index 30915df283b7ea1b7ae9800229153e94a84c7d29..6b1afb618ea1c6c4f5d3d40ae15005b709bcd83f 100644 (file)
@@ -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) {