[PATCH 02/07] Add project filter configuration option

The Ranger ranger at risk.ee
Fri Nov 27 21:46:24 CET 2015


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



More information about the CGit mailing list