diff options
author | Chris Burroughs | 2014-08-04 09:23:08 -0400 |
---|---|---|
committer | Jason A. Donenfeld | 2014-12-23 19:08:20 -0700 |
commit | 96ceb9a95a7a321209cff347fefd141a9fffc7ca (patch) | |
tree | 5077ac54da1f7992d991746492855665454147c9 /cgit.c | |
parent | 3c53ebfb57a5dba8fc65b2f99ebbfb6356666e34 (diff) | |
download | cgit-96ceb9a95a7a321209cff347fefd141a9fffc7ca.tar.gz cgit-96ceb9a95a7a321209cff347fefd141a9fffc7ca.tar.bz2 cgit-96ceb9a95a7a321209cff347fefd141a9fffc7ca.zip |
repolist: add owner-filter
This allows custom links to be used for repository owners by
configuring a filter to be applied in the "Owner" column in the
repository list.
Diffstat (limited to 'cgit.c')
-rw-r--r-- | cgit.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -91,6 +91,8 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va | |||
91 | repo->source_filter = cgit_new_filter(value, SOURCE); | 91 | repo->source_filter = cgit_new_filter(value, SOURCE); |
92 | else if (!strcmp(name, "email-filter")) | 92 | else if (!strcmp(name, "email-filter")) |
93 | repo->email_filter = cgit_new_filter(value, EMAIL); | 93 | repo->email_filter = cgit_new_filter(value, EMAIL); |
94 | else if (!strcmp(name, "owner-filter")) | ||
95 | repo->owner_filter = cgit_new_filter(value, OWNER); | ||
94 | } | 96 | } |
95 | } | 97 | } |
96 | 98 | ||
@@ -194,6 +196,8 @@ static void config_cb(const char *name, const char *value) | |||
194 | ctx.cfg.commit_filter = cgit_new_filter(value, COMMIT); | 196 | ctx.cfg.commit_filter = cgit_new_filter(value, COMMIT); |
195 | else if (!strcmp(name, "email-filter")) | 197 | else if (!strcmp(name, "email-filter")) |
196 | ctx.cfg.email_filter = cgit_new_filter(value, EMAIL); | 198 | ctx.cfg.email_filter = cgit_new_filter(value, EMAIL); |
199 | else if (!strcmp(name, "owner-filter")) | ||
200 | ctx.cfg.owner_filter = cgit_new_filter(value, OWNER); | ||
197 | else if (!strcmp(name, "auth-filter")) | 201 | else if (!strcmp(name, "auth-filter")) |
198 | ctx.cfg.auth_filter = cgit_new_filter(value, AUTH); | 202 | ctx.cfg.auth_filter = cgit_new_filter(value, AUTH); |
199 | else if (!strcmp(name, "embedded")) | 203 | else if (!strcmp(name, "embedded")) |
@@ -800,6 +804,8 @@ static void print_repo(FILE *f, struct cgit_repo *repo) | |||
800 | cgit_fprintf_filter(repo->source_filter, f, "repo.source-filter="); | 804 | cgit_fprintf_filter(repo->source_filter, f, "repo.source-filter="); |
801 | if (repo->email_filter && repo->email_filter != ctx.cfg.email_filter) | 805 | if (repo->email_filter && repo->email_filter != ctx.cfg.email_filter) |
802 | cgit_fprintf_filter(repo->email_filter, f, "repo.email-filter="); | 806 | cgit_fprintf_filter(repo->email_filter, f, "repo.email-filter="); |
807 | if (repo->owner_filter && repo->owner_filter != ctx.cfg.owner_filter) | ||
808 | cgit_fprintf_filter(repo->owner_filter, f, "repo.owner-filter="); | ||
803 | if (repo->snapshots != ctx.cfg.snapshots) { | 809 | if (repo->snapshots != ctx.cfg.snapshots) { |
804 | char *tmp = build_snapshot_setting(repo->snapshots); | 810 | char *tmp = build_snapshot_setting(repo->snapshots); |
805 | fprintf(f, "repo.snapshots=%s\n", tmp ? tmp : ""); | 811 | fprintf(f, "repo.snapshots=%s\n", tmp ? tmp : ""); |