mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-17 03:00:59 +01:00
Allows to hide repos with regex
This commit is contained in:
@@ -8,7 +8,7 @@ repositories[] = '/home/git/repositories/' ; Path to your repositories
|
||||
;client = '"C:\Program Files (x86)\Git\bin\git.exe"' ; Your git executable path
|
||||
;repositories[] = 'C:\Path\to\Repos\' ; Path to your repositories
|
||||
|
||||
; You can hide repositories from GitList, just copy this for each repository you want to hide
|
||||
; You can hide repositories from GitList, just copy this for each repository you want to hide or add a regex (including delimiters), eg. hidden[] = '/(.+)\.git/'
|
||||
; hidden[] = '/home/git/repositories/BetaTest'
|
||||
|
||||
[app]
|
||||
|
||||
@@ -82,7 +82,20 @@ class Client extends BaseClient
|
||||
$isRepository = file_exists($file->getPathname() . '/.git/HEAD');
|
||||
|
||||
if ($isRepository || $isBare) {
|
||||
if (in_array($file->getPathname(), $this->getHidden())) {
|
||||
|
||||
$hidden = function($path, $hide) {
|
||||
|
||||
$return = false;
|
||||
|
||||
array_walk($hide, function($value, $key) use ($path, &$return) {
|
||||
if ( ($path === $value) || (1 === preg_match($value, $path)) ) {
|
||||
$return = true;
|
||||
}
|
||||
});
|
||||
return $return;
|
||||
};
|
||||
|
||||
if ($hidden($file->getPathname(), $this->getHidden())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user