List for cgit developers and users
 help / color / mirror / Atom feed
From: richard.maw at gmail.com (Richard Maw)
Subject: [PATCH v3 19/21] Allow agefile to be set per-repository
Date: Mon,  1 Aug 2016 22:35:51 +0100	[thread overview]
Message-ID: <20160801213553.16807-20-richard.maw@gmail.com> (raw)
In-Reply-To: <20160801213553.16807-1-richard.maw@gmail.com>

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 at gmail.com>
---
 cgit.c        | 2 ++
 cgit.h        | 1 +
 ui-repolist.c | 3 ++-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/cgit.c b/cgit.c
index 321a00f..f7df288 100644
--- 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 e915490..485949a 100644
--- 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;
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) {
-- 
2.9.0



  parent reply	other threads:[~2016-08-01 21:35 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-01 21:35 [PATCH v3 00/21] Add namespace support to cgit richard.maw
2016-08-01 21:35 ` [PATCH v3 01/21] Return a copy of "master" when guessing defbranch fails richard.maw
2016-08-01 21:35 ` [PATCH v3 02/21] Fix archive generation richard.maw
2016-08-01 21:35 ` [PATCH v3 03/21] Add a wrapper for get_sha1 called cgit_get_sha1 richard.maw
2016-08-01 21:35 ` [PATCH v3 04/21] Parse repo.namespace richard.maw
2016-08-01 21:35 ` [PATCH v3 05/21] Print out parsed namespace on request richard.maw
2016-08-01 21:35 ` [PATCH v3 06/21] Set GIT_NAMESPACE when repo.namespace is provided richard.maw
2016-08-01 21:35 ` [PATCH v3 07/21] Add namespaced resolve ref helper richard.maw
2016-08-01 21:35 ` [PATCH v3 08/21] Add cgit_namespaced_dwim_ref for resolving short refs richard.maw
2016-08-01 21:35 ` [PATCH v3 09/21] Look up refs in namespace with cgit_get_sha1 richard.maw
2016-08-01 21:35 ` [PATCH v3 10/21] Use cgit_namespaced_dwim_ref for finding logs to show richard.maw
2016-08-01 21:35 ` [PATCH v3 11/21] Render commit decorations correctly richard.maw
2016-08-01 21:35 ` [PATCH v3 12/21] Guess the default branch based on current namespace richard.maw
2016-08-01 21:35 ` [PATCH v3 13/21] Add cgit_for_each_namespaced_ref_in helper richard.maw
2016-08-01 21:35 ` [PATCH v3 14/21] Find the default branch based on the contents of the namespace richard.maw
2016-08-01 21:35 ` [PATCH v3 15/21] Only display refs in current namespace richard.maw
2016-08-01 21:35 ` [PATCH v3 16/21] Add namespace support to dumb-clone richard.maw
2016-08-01 21:35 ` [PATCH v3 17/21] Display notes from namespace richard.maw
2016-08-20 14:51   ` richard.maw
2016-08-01 21:35 ` [PATCH v3 18/21] Add documentation for repo.namespace richard.maw
2016-08-01 21:35 ` richard.maw [this message]
2016-08-01 21:35 ` [PATCH v3 20/21] Update contrib script to update agefiles per namespace richard.maw
2016-08-01 21:35 ` [PATCH v3 21/21] Add documentation for repo.agefile richard.maw
2016-08-20 16:01 ` [PATCH v3 00/21] Add namespace support to cgit richard.maw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160801213553.16807-20-richard.maw@gmail.com \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).