* [HACK] gitweb: Support hiding of chosen repositories from project list
@ 2008-07-08 16:56 Petr Baudis
0 siblings, 0 replies; only message in thread
From: Petr Baudis @ 2008-07-08 16:56 UTC (permalink / raw)
To: git
This makes it possible to hide certain repository from project list
(while still keeping it accessible, so it's not just an inverse of
export-ok). By default the file that needs to be created in the
repository is '.hide'.
Signed-off-by: Petr Baudis <pasky@suse.cz>
---
I used this for something at repo.or.cz, but it is actually lying around
unused in my patch queue now; before removing it, I'm going to archive it on
the mailing list, maybe someone will find it useful.
Makefile | 2 ++
gitweb/gitweb.perl | 11 +++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 3314dd6..b7c7f42 100644
--- a/Makefile
+++ b/Makefile
@@ -195,6 +195,7 @@ GITWEB_SITENAME =
GITWEB_PROJECTROOT = /pub/git
GITWEB_PROJECT_MAXDEPTH = 2007
GITWEB_EXPORT_OK =
+GITWEB_HIDE_REPO = .hide
GITWEB_STRICT_EXPORT =
GITWEB_BASE_URL =
GITWEB_LIST =
@@ -1130,6 +1131,7 @@ gitweb/gitweb.cgi: gitweb/gitweb.perl
-e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
-e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
-e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
+ -e 's|++GITWEB_HIDE_REPO++|$(GITWEB_HIDE_REPO)|g' \
-e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
-e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
-e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 3b02d87..7ad0faa 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -90,6 +90,11 @@ our $default_projects_order = "project";
# (only effective if this variable evaluates to true)
our $export_ok = "++GITWEB_EXPORT_OK++";
+# hide repository from the list if this file exists
+# (the repository is still accessible, just not shown in the project list)
+# (only effective if this variable evaulates to true)
+our $hide_repo = "++GITWEB_HIDE_REPO++";
+
# only allow viewing of repositories also shown on the overview page
our $strict_export = "++GITWEB_STRICT_EXPORT++";
@@ -1796,7 +1801,8 @@ sub git_get_projects_list {
# we check related file in $projectroot
if ($check_forks and $subdir =~ m#/.#) {
$File::Find::prune = 1;
- } elsif (check_export_ok("$projectroot/$filter/$subdir")) {
+ } elsif ((!$hide_repo or ! -e "$projectroot/$filter/$subdir/$hide_repo")
+ and check_export_ok("$projectroot/$filter/$subdir")) {
push @list, { path => ($filter ? "$filter/" : '') . $subdir };
$File::Find::prune = 1;
}
@@ -1846,7 +1852,8 @@ sub git_get_projects_list {
next PROJECT;
}
}
- if (check_export_ok("$projectroot/$path")) {
+ if ((!$hide_repo or ! -e "$projectroot/$path/$hide_repo")
+ and check_export_ok("$projectroot/$path")) {
my $pr = {
path => $path,
owner => to_utf8($owner),
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-07-08 17:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-08 16:56 [HACK] gitweb: Support hiding of chosen repositories from project list Petr Baudis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox