Allows to hide repos with regex

This commit is contained in:
Nicolas Da Mutten
2017-01-08 17:45:44 +01:00
parent b507e27862
commit 355943b27a
2 changed files with 15 additions and 2 deletions

View File

@@ -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]

View File

@@ -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;
}