List for cgit developers and users
 help / color / mirror / Atom feed
* [PATCH 02/07] Add project filter configuration option
@ 2015-11-27 20:46 ranger
  0 siblings, 0 replies; only message in thread
From: ranger @ 2015-11-27 20:46 UTC (permalink / 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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-27 20:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-27 20:46 [PATCH 02/07] Add project filter configuration option ranger

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