aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer2015-01-29 12:52:49 +0100
committerJason A. Donenfeld2015-01-29 16:41:14 +0100
commitc58cec9dff273b44c428cfaee24e5e3743c0034e (patch)
tree7302ee9868fa94b9cf64a2a361294ad2e4bc360f
parent1a2eeb94d42b983213076906eb5c5b85452b2c30 (diff)
downloadcgit-c58cec9dff273b44c428cfaee24e5e3743c0034e.tar.gz
cgit-c58cec9dff273b44c428cfaee24e5e3743c0034e.tar.bz2
cgit-c58cec9dff273b44c428cfaee24e5e3743c0034e.zip
Add repo.hide and repo.ignore
These options can be used to hide a repository from the index or completely ignore a repository, respectively. They are particularly useful when used in combination with scan-path. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
-rw-r--r--cgit.c6
-rw-r--r--cgit.h2
-rw-r--r--cgitrc.5.txt10
-rw-r--r--shared.c3
-rw-r--r--ui-repolist.c2
5 files changed, 23 insertions, 0 deletions
diff --git a/cgit.c b/cgit.c
index 79019c2..431e325 100644
--- a/cgit.c
+++ b/cgit.c
@@ -93,6 +93,10 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va
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")) 94 else if (!strcmp(name, "owner-filter"))
95 repo->owner_filter = cgit_new_filter(value, OWNER); 95 repo->owner_filter = cgit_new_filter(value, OWNER);
96 } else if (!strcmp(name, "hide")) {
97 repo->hide = atoi(value);
98 } else if (!strcmp(name, "ignore")) {
99 repo->ignore = atoi(value);
96 } 100 }
97} 101}
98 102
@@ -828,6 +832,8 @@ static void print_repo(FILE *f, struct cgit_repo *repo)
828 else if (repo->commit_sort == 2) 832 else if (repo->commit_sort == 2)
829 fprintf(f, "repo.commit-sort=topo\n"); 833 fprintf(f, "repo.commit-sort=topo\n");
830 } 834 }
835 fprintf(f, "repo.hide=%d\n", repo->hide);
836 fprintf(f, "repo.ignore=%d\n", repo->ignore);
831 fprintf(f, "\n"); 837 fprintf(f, "\n");
832} 838}
833 839
diff --git a/cgit.h b/cgit.h
index 42140ac..16f8092 100644
--- a/cgit.h
+++ b/cgit.h
@@ -106,6 +106,8 @@ struct cgit_repo {
106 struct cgit_filter *email_filter; 106 struct cgit_filter *email_filter;
107 struct cgit_filter *owner_filter; 107 struct cgit_filter *owner_filter;
108 struct string_list submodules; 108 struct string_list submodules;
109 int hide;
110 int ignore;
109}; 111};
110 112
111typedef void (*repo_config_fn)(struct cgit_repo *repo, const char *name, 113typedef void (*repo_config_fn)(struct cgit_repo *repo, const char *name,
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index be6703f..e21ece9 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -509,6 +509,16 @@ repo.enable-subject-links::
509 A flag which can be used to override the global setting 509 A flag which can be used to override the global setting
510 `enable-subject-links'. Default value: none. 510 `enable-subject-links'. Default value: none.
511 511
512repo.hide::
513 Flag which, when set to "1", hides the repository from the repository
514 index. The repository can still be accessed by providing a direct path.
515 Default value: "0". See also: "repo.ignore".
516
517repo.ignore::
518 Flag which, when set to "1", ignores the repository. The repository
519 is not shown in the index and cannot be accessed by providing a direct
520 path. Default value: "0". See also: "repo.hide".
521
512repo.logo:: 522repo.logo::
513 Url which specifies the source of an image which will be used as a logo 523 Url which specifies the source of an image which will be used as a logo
514 on this repo's pages. Default value: global logo. 524 on this repo's pages. Default value: global logo.
diff --git a/shared.c b/shared.c
index 6e91857..ae17d78 100644
--- a/shared.c
+++ b/shared.c
@@ -75,6 +75,7 @@ struct cgit_repo *cgit_add_repo(const char *url)
75 ret->owner_filter = ctx.cfg.owner_filter; 75 ret->owner_filter = ctx.cfg.owner_filter;
76 ret->clone_url = ctx.cfg.clone_url; 76 ret->clone_url = ctx.cfg.clone_url;
77 ret->submodules.strdup_strings = 1; 77 ret->submodules.strdup_strings = 1;
78 ret->hide = ret->ignore = 0;
78 return ret; 79 return ret;
79} 80}
80 81
@@ -85,6 +86,8 @@ struct cgit_repo *cgit_get_repoinfo(const char *url)
85 86
86 for (i = 0; i < cgit_repolist.count; i++) { 87 for (i = 0; i < cgit_repolist.count; i++) {
87 repo = &cgit_repolist.repos[i]; 88 repo = &cgit_repolist.repos[i];
89 if (repo->ignore)
90 continue;
88 if (!strcmp(repo->url, url)) 91 if (!strcmp(repo->url, url))
89 return repo; 92 return repo;
90 } 93 }
diff --git a/ui-repolist.c b/ui-repolist.c
index f929cb7..91911e0 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -275,6 +275,8 @@ void cgit_print_repolist()
275 html("<table summary='repository list' class='list nowrap'>"); 275 html("<table summary='repository list' class='list nowrap'>");
276 for (i = 0; i < cgit_repolist.count; i++) { 276 for (i = 0; i < cgit_repolist.count; i++) {
277 ctx.repo = &cgit_repolist.repos[i]; 277 ctx.repo = &cgit_repolist.repos[i];
278 if (ctx.repo->hide || ctx.repo->ignore)
279 continue;
278 if (!(is_match(ctx.repo) && is_in_url(ctx.repo))) 280 if (!(is_match(ctx.repo) && is_in_url(ctx.repo)))
279 continue; 281 continue;
280 hits++; 282 hits++;