diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -2,10 +2,11 @@ function find_projects(string $path, array $projects = []): array { $directories = glob($path . "/{.[!.],}*", GLOB_ONLYDIR | GLOB_BRACE); - foreach ($directories as $directory) { - if (str_ends_with($directory, ".git")) { - $projects[] = substr($directory, 0, -4); - } else { + if (($idx = array_search("$path/.git", $directories)) !== false) { + $projects[] = substr($directories[$idx], 0, -4); + } + else { + foreach ($directories as $directory) { $projects += find_projects($directory, $projects); } } |