diff --git a/config.ini-example b/config.ini-example index ebc306c..38011a3 100644 --- a/config.ini-example +++ b/config.ini-example @@ -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] diff --git a/src/Git/Client.php b/src/Git/Client.php index 38db082..0dae86e 100644 --- a/src/Git/Client.php +++ b/src/Git/Client.php @@ -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; }