{"thread":{"id":"14347","subject":"[HACK] gitweb: Support hiding of chosen repositories from project list","startedAt":"2008-07-08T16:56:55Z","lastAt":"2008-07-08T16:56:55Z","messageCount":1,"participants":["Petr Baudis"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"82613","messageId":"20080708165445.10663.26304.stgit@rover.dkm.cz","threadId":"14347","inReplyTo":null,"subject":"[HACK] gitweb: Support hiding of chosen repositories from project list","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-07-08T16:56:55Z","receivedAt":"2008-07-08T16:56:55Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"This makes it possible to hide certain repository from project list\n(while still keeping it accessible, so it's not just an inverse of\n export-ok). By default the file that needs to be created in the\nrepository is '.hide'.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n---\n\n  I used this for something at repo.or.cz, but it is actually lying around\nunused in my patch queue now; before removing it, I'm going to archive it on\nthe mailing list, maybe someone will find it useful.\n\n Makefile           |    2 ++\n gitweb/gitweb.perl |   11 +++++++++--\n 2 files changed, 11 insertions(+), 2 deletions(-)\n\n\ndiff --git a/Makefile b/Makefile\nindex 3314dd6..b7c7f42 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -195,6 +195,7 @@ GITWEB_SITENAME =\n GITWEB_PROJECTROOT = /pub/git\n GITWEB_PROJECT_MAXDEPTH = 2007\n GITWEB_EXPORT_OK =\n+GITWEB_HIDE_REPO = .hide\n GITWEB_STRICT_EXPORT =\n GITWEB_BASE_URL =\n GITWEB_LIST =\n@@ -1130,6 +1131,7 @@ gitweb/gitweb.cgi: gitweb/gitweb.perl\n \t    -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \\\n \t    -e 's|\"++GITWEB_PROJECT_MAXDEPTH++\"|$(GITWEB_PROJECT_MAXDEPTH)|g' \\\n \t    -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \\\n+\t    -e 's|++GITWEB_HIDE_REPO++|$(GITWEB_HIDE_REPO)|g' \\\n \t    -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \\\n \t    -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \\\n \t    -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \\\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 3b02d87..7ad0faa 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -90,6 +90,11 @@ our $default_projects_order = \"project\";\n # (only effective if this variable evaluates to true)\n our $export_ok = \"++GITWEB_EXPORT_OK++\";\n \n+# hide repository from the list if this file exists\n+# (the repository is still accessible, just not shown in the project list)\n+# (only effective if this variable evaulates to true)\n+our $hide_repo = \"++GITWEB_HIDE_REPO++\";\n+\n # only allow viewing of repositories also shown on the overview page\n our $strict_export = \"++GITWEB_STRICT_EXPORT++\";\n \n@@ -1796,7 +1801,8 @@ sub git_get_projects_list {\n \t\t\t\t# we check related file in $projectroot\n \t\t\t\tif ($check_forks and $subdir =~ m#/.#) {\n \t\t\t\t\t$File::Find::prune = 1;\n-\t\t\t\t} elsif (check_export_ok(\"$projectroot/$filter/$subdir\")) {\n+\t\t\t\t} elsif ((!$hide_repo or ! -e \"$projectroot/$filter/$subdir/$hide_repo\")\n+\t\t\t\t    and check_export_ok(\"$projectroot/$filter/$subdir\")) {\n \t\t\t\t\tpush @list, { path => ($filter ? \"$filter/\" : '') . $subdir };\n \t\t\t\t\t$File::Find::prune = 1;\n \t\t\t\t}\n@@ -1846,7 +1852,8 @@ sub git_get_projects_list {\n \t\t\t\t\tnext PROJECT;\n \t\t\t\t}\n \t\t\t}\n-\t\t\tif (check_export_ok(\"$projectroot/$path\")) {\n+\t\t\tif ((!$hide_repo or ! -e \"$projectroot/$path/$hide_repo\")\n+\t\t\t    and check_export_ok(\"$projectroot/$path\")) {\n \t\t\t\tmy $pr = {\n \t\t\t\t\tpath => $path,\n \t\t\t\t\towner => to_utf8($owner),\n"}]}