List for cgit developers and users
 help / color / mirror / Atom feed
From: ranger at risk.ee (The Ranger)
Subject: [PATCH 02/07] Add project filter configuration option
Date: Fri, 27 Nov 2015 20:46:24 -0000	[thread overview]
Message-ID: <1448657208.454141.7281.nullmailer@cypher.risk.ee> (raw)

---
 cgit.c   | 2 ++
 cgit.h   | 3 ++-
 filter.c | 5 +++++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/cgit.c b/cgit.c
index 50f7abb..75fcc92 100644
--- a/cgit.c
+++ b/cgit.c
@@ -206,6 +206,8 @@ static void config_cb(const char *name, const char *value)
 		ctx.cfg.owner_filter = cgit_new_filter(value, OWNER);
 	else if (!strcmp(name, "auth-filter"))
 		ctx.cfg.auth_filter = cgit_new_filter(value, AUTH);
+	else if (!strcmp(name, "project-filter"))
+		ctx.cfg.project_filter = cgit_new_filter(value, PROJECT);
 	else if (!strcmp(name, "embedded"))
 		ctx.cfg.embedded = atoi(value);
 	else if (!strcmp(name, "max-atom-items"))
diff --git a/cgit.h b/cgit.h
index b5eecb6..4871110 100644
--- a/cgit.h
+++ b/cgit.h
@@ -62,7 +62,7 @@ typedef enum {
 } diff_type;
 
 typedef enum {
-	ABOUT, COMMIT, SOURCE, EMAIL, AUTH, OWNER
+	ABOUT, COMMIT, SOURCE, EMAIL, AUTH, OWNER, PROJECT
 } filter_type;
 
 struct cgit_filter {
@@ -269,6 +269,7 @@ struct cgit_config {
 	struct cgit_filter *email_filter;
 	struct cgit_filter *owner_filter;
 	struct cgit_filter *auth_filter;
+	struct cgit_filter *project_filter;
 };
 
 struct cgit_page {
diff --git a/filter.c b/filter.c
index 949c931..0792cbb 100644
--- a/filter.c
+++ b/filter.c
@@ -30,6 +30,7 @@ void cgit_cleanup_filters(void)
 	reap_filter(ctx.cfg.email_filter);
 	reap_filter(ctx.cfg.owner_filter);
 	reap_filter(ctx.cfg.auth_filter);
+	reap_filter(ctx.cfg.project_filter);
 	for (i = 0; i < cgit_repolist.count; ++i) {
 		reap_filter(cgit_repolist.repos[i].about_filter);
 		reap_filter(cgit_repolist.repos[i].commit_filter);
@@ -436,6 +437,10 @@ struct cgit_filter *cgit_new_filter(const char *cmd, filter_type filtertype)
 			argument_count = 1;
 			break;
 
+		case PROJECT:
+			argument_count = 5;
+			break;
+
 		case COMMIT:
 		default:
 			argument_count = 0;
-- 
2.1.4



                 reply	other threads:[~2015-11-27 20:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1448657208.454141.7281.nullmailer@cypher.risk.ee \
    --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).