[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cgit
Subject:    [PATCH 02/07] Add project filter configuration option
From:       The Ranger <ranger () risk ! ee>
Date:       2015-11-27 20:46:48
Message-ID: 1448657208.454141.7281.nullmailer () cypher ! risk ! ee
[Download RAW message or body]

---
 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

_______________________________________________
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic